mirror of
https://github.com/tiennm99/miti99.git
synced 2026-09-16 14:23:43 +00:00
[Change] dockerfile
This commit is contained in:
+11
-21
@@ -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
@@ -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
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user