Update Dockerfile
Build website container / Build image (push) Successful in 25s Details

This commit is contained in:
LordMathis 2024-02-15 21:59:46 +01:00
parent 14d3a06479
commit b8a62de72d
1 changed files with 17 additions and 4 deletions

View File

@ -1,14 +1,27 @@
FROM golang:1.21 as build FROM golang:1.21-bookworm as build
ARG DART_SASS_VERSION=1.70.0
ARG HUGO_VERSION=0.122.0
WORKDIR /app WORKDIR /app
RUN go install -tags extended github.com/gohugoio/hugo@latest # Install Dart Sass
RUN curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
cp -r dart-sass/* /usr/local/bin && \
rm -rf dart-sass*
# Install Hugo
RUN curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb && \
apt install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb && \
rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
COPY . /app COPY . /app
RUN hugo mod get -u && \ RUN hugo mod get -u && \
hugo hugo --gc --minify
FROM nginx:stable-alpine FROM nginx:stable-alpine
COPY --from=build /app/public /usr/share/nginx/html/ COPY --from=build /app/public /usr/share/nginx/html/
COPY ./nginx.conf /etc/nginx/conf.d/default.conf COPY ./nginx.conf /etc/nginx/conf.d/default.conf