-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (21 loc) · 785 Bytes
/
Dockerfile
File metadata and controls
28 lines (21 loc) · 785 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
# Pin nginx version for reproducible builds
FROM nginx:1.31-alpine
# Copy custom nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy the static website files to the nginx web root
COPY ./output /usr/share/nginx/html
# Fix permissions for non-root user
RUN chown -R nginx:nginx /usr/share/nginx/html && \
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid
# Run as non-root user
USER nginx
# Expose port 80 for serving the site
EXPOSE 80
# Health check for container orchestrators
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD wget -qO- http://localhost:80/ || exit 1
# Start nginx server
CMD ["nginx", "-g", "daemon off;"]