fix: update Dockerfile to use correct Hugo base image and adjust build process
This commit is contained in:
parent
af44031f05
commit
0708e33448
1 changed files with 20 additions and 6 deletions
26
Dockerfile
26
Dockerfile
|
|
@ -1,6 +1,11 @@
|
||||||
FROM klakegg/hugo:ext-alpine-onbuild AS builder
|
# -------------------------
|
||||||
|
# 1) Build Hugo
|
||||||
|
# -------------------------
|
||||||
|
FROM klakegg/hugo:ext-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Copier tout le projet Hugo
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build-time env vars used by Hugo templates.
|
# 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_EVENT=$HUGO_FORMBRICKS_EVENT
|
||||||
ENV HUGO_FORMBRICKS_SDK_URL=$HUGO_FORMBRICKS_SDK_URL
|
ENV HUGO_FORMBRICKS_SDK_URL=$HUGO_FORMBRICKS_SDK_URL
|
||||||
|
|
||||||
RUN mkdir -p /out \
|
# Build du site
|
||||||
&& hugo --config ./hugo.toml --environment production --minify --destination /out \
|
RUN hugo --minify
|
||||||
&& test -f /out/index.html
|
|
||||||
|
|
||||||
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
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Lancer Nginx
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue