karsttech.com/Dockerfile

31 lines
603 B
Text
Raw Normal View History

2025-04-04 20:18:20 -04:00
# Build stage
FROM golang:1.21-alpine AS builder
# Install Hugo, Git, and SSL certificates
RUN apk add --no-cache hugo git ca-certificates
2025-04-04 20:18:20 -04:00
# Copy the repository contents
COPY . .
# Initialize submodules
2025-04-04 21:09:52 -04:00
RUN git status
RUN git submodule status
RUN git submodule update --init
2025-04-04 20:55:12 -04:00
2025-04-04 20:18:20 -04:00
# Build the site
RUN hugo --minify
# Production stage
FROM nginx:alpine
# Copy the built site from builder
2025-04-04 20:57:55 -04:00
COPY --from=builder /public /usr/share/nginx/html
2025-04-04 20:18:20 -04:00
# Copy custom nginx config if needed
# COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]