Setup repo for local, dev and production

This commit is contained in:
2025-09-06 14:28:46 +10:00
parent 7a9a8a1f15
commit 898ad5e541
40 changed files with 236 additions and 64 deletions

View File

@ -1,22 +1,31 @@
###############
# Build Stage #
###############
FROM hugomods/hugo:exts as builder
# Base URL
# ARG HUGO_BASEURL=
# ENV HUGO_BASEURL=${HUGO_BASEURL}
# Build site
FROM hugomods/hugo:exts AS builder
# Base URL can be overridden at build time
ARG HUGO_BASEURL
ENV HUGO_BASEURL=${HUGO_BASEURL}
# Copy source code
COPY . /src
RUN hugo --minify --gc
# Set the fallback 404 page if defaultContentLanguageInSubdir is enabled, please replace the `en` with your default language code.
# Build site with optional baseURL override
RUN if [ -z "$HUGO_BASEURL" ]; then \
echo "Building site using baseURL from hugo.toml"; \
hugo --minify --gc --enableGitInfo; \
else \
echo "Building site with HUGO_BASEURL=$HUGO_BASEURL"; \
hugo --minify --gc --enableGitInfo --baseURL "$HUGO_BASEURL"; \
fi
# Optional: fallback 404 page for multi-language sites
# RUN cp ./public/en/404.html ./public/404.html
###############
# Final Stage #
###############
FROM hugomods/hugo:nginx
LABEL "Matthew McKinnon"="<support@comprofix.com>"
# Copy built static site
COPY --from=builder /src/public /site