[Change] dockerfile

This commit is contained in:
2024-09-14 17:14:54 +07:00
parent a1c794c83a
commit 477a72ea05
2 changed files with 11 additions and 33 deletions
+11 -21
View File
@@ -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
COPY --from=builder /site/public /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
-12
View File
@@ -1,12 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
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
'';
}