diff --git a/Dockerfile b/Dockerfile index 424ab17..c9b8d36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,18 @@ -FROM ubuntu:latest +FROM golang:1.22 AS builder -ENV HUGO_VERSION=0.124.0 -ENV HUGO_ENVIRONMENT=production -ENV HUGO_ENV=production +RUN apt-get update && apt-get install -y git +RUN go install -tags extended github.com/gohugoio/hugo@0.124.0 -RUN apt-get update && apt-get install -y \ - git \ - golang \ - nodejs \ - npm \ - wget - -RUN wget -O /tmp/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-arm64.deb \ - && dpkg -i /tmp/hugo.deb \ - && rm /tmp/hugo.deb - -RUN npm install -g sass - -WORKDIR /src +WORKDIR /site COPY . . -RUN [ -f package-lock.json ] && npm ci || echo "No package-lock.json found. Skipping npm ci." +RUN hugo --minify -RUN hugo --gc --minify +FROM nginx:alpine -WORKDIR /src/public \ No newline at end of file +COPY --from=builder /site/public /usr/share/nginx/html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/default.nix b/default.nix deleted file mode 100644 index 029dc3e..0000000 --- a/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs ? import {} }: -pkgs.stdenv.mkDerivation { - name = "hugo-build"; - buildInputs = [ go, pkgs.hugo_extended ]; - buildPhase = '' - mkdir -p /app/public - hugo --minify --destination /app/public - ''; - installPhase = '' - cp -r /app/public/* $out - ''; -} \ No newline at end of file