2025-04-04 20:18:20 -04:00
|
|
|
# Build stage
|
2025-04-04 22:17:34 -04:00
|
|
|
FROM golang:1.24-alpine AS builder
|
2025-04-04 20:18:20 -04:00
|
|
|
|
2025-04-04 22:17:34 -04:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install Hugo and Git
|
2025-04-04 22:51:01 -04:00
|
|
|
RUN apk add --no-cache hugo git
|
2025-04-04 20:18:20 -04:00
|
|
|
|
|
|
|
|
# Copy the repository contents
|
|
|
|
|
COPY . .
|
|
|
|
|
|
2025-04-04 22:32:03 -04:00
|
|
|
# Build the site with verbose output
|
2025-04-04 22:51:01 -04:00
|
|
|
RUN hugo --minify
|
2025-04-04 20:18:20 -04:00
|
|
|
|
2026-01-07 18:33:15 -05:00
|
|
|
# Pre-compress files for nginx gzip_static
|
|
|
|
|
RUN find /app/public -type f \( -name '*.html' -o -name '*.js' -o -name '*.css' -o -name '*.xml' -o -name '*.json' -o -name '*.svg' -o -name '*.woff' -o -name '*.woff2' -o -name '*.ttf' -o -name '*.otf' -o -name '*.eot' \) -exec gzip -k -9 {} \;
|
|
|
|
|
|
2025-04-04 20:18:20 -04:00
|
|
|
# Production stage
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
|
|
|
|
# Copy the built site from builder
|
2025-04-04 22:17:34 -04:00
|
|
|
COPY --from=builder /app/public /usr/share/nginx/html
|
2025-04-04 20:18:20 -04:00
|
|
|
|
2026-01-07 18:33:15 -05:00
|
|
|
# Copy custom nginx config
|
|
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
2025-04-04 20:18:20 -04:00
|
|
|
|
|
|
|
|
# Expose port 80
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
|
|
# Start nginx
|
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|