fix: update Dockerfile to use correct Hugo base image and adjust build process

This commit is contained in:
Cheick Oumar 2026-05-17 17:33:20 +02:00
commit 0708e33448

View file

@ -1,6 +1,11 @@
FROM klakegg/hugo:ext-alpine-onbuild AS builder
# -------------------------
# 1) Build Hugo
# -------------------------
FROM klakegg/hugo:ext-alpine AS builder
WORKDIR /src
# Copier tout le projet Hugo
COPY . .
# Build-time env vars used by Hugo templates.
@ -18,13 +23,22 @@ ENV HUGO_FORMBRICKS_ENV_ID=$HUGO_FORMBRICKS_ENV_ID
ENV HUGO_FORMBRICKS_EVENT=$HUGO_FORMBRICKS_EVENT
ENV HUGO_FORMBRICKS_SDK_URL=$HUGO_FORMBRICKS_SDK_URL
RUN mkdir -p /out \
&& hugo --config ./hugo.toml --environment production --minify --destination /out \
&& test -f /out/index.html
# Build du site
RUN hugo --minify
FROM nginx:1.27-alpine
# -------------------------
# 2) Image finale NGINX
# -------------------------
FROM nginx:alpine
COPY --from=builder /out /usr/share/nginx/html
# Supprimer la config par défaut
RUN rm -rf /usr/share/nginx/html/*
# Copier les fichiers générés par Hugo
COPY --from=builder /src/public /usr/share/nginx/html
# Exposer le port
EXPOSE 80
# Lancer Nginx
CMD ["nginx", "-g", "daemon off;"]