-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (26 loc) · 789 Bytes
/
Dockerfile
File metadata and controls
32 lines (26 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Simple multi-stage Dockerfile for Hugo site
FROM klakegg/hugo:ext-alpine AS builder
WORKDIR /src
COPY . .
# Build the Hugo site
RUN hugo --minify
# Production stage
FROM nginx:alpine
# Copy built site from builder
COPY --from=builder /src/public /usr/share/nginx/html
# Add basic security headers via nginx config
RUN echo 'server { \
listen 80; \
server_name localhost; \
root /usr/share/nginx/html; \
\
add_header X-Frame-Options "SAMEORIGIN" always; \
add_header X-Content-Type-Options "nosniff" always; \
add_header X-XSS-Protection "1; mode=block" always; \
add_header Referrer-Policy "strict-origin-when-cross-origin" always; \
\
location / { \
try_files $uri $uri/ =404; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80