29 lines
513 B
Text
29 lines
513 B
Text
|
# Build stage
|
||
|
FROM golang:1.21-alpine AS builder
|
||
|
|
||
|
# Install Hugo and Git
|
||
|
RUN apk add --no-cache hugo git
|
||
|
|
||
|
# Set working directory
|
||
|
WORKDIR /app
|
||
|
|
||
|
# Copy the repository contents
|
||
|
COPY . .
|
||
|
|
||
|
# Build the site
|
||
|
RUN hugo --minify
|
||
|
|
||
|
# Production stage
|
||
|
FROM nginx:alpine
|
||
|
|
||
|
# Copy the built site from builder
|
||
|
COPY --from=builder /app/public /usr/share/nginx/html
|
||
|
|
||
|
# 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;"]
|