-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 1.31 KB
/
Dockerfile
File metadata and controls
39 lines (29 loc) · 1.31 KB
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
33
34
35
36
37
38
39
FROM nginx:alpine
LABEL org.opencontainers.image.authors="Christian Kaczmarek" \
org.opencontainers.image.description="Opinionated nginx reverse proxy Docker image for homelab use" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.source="https://github.com/kaczmar2/nginx-reverse-proxy"
# Create directory structure to match expected volume mounts
RUN mkdir -p /etc/nginx/includes \
&& mkdir -p /etc/nginx/sites \
&& mkdir -p /etc/nginx/ssl
# Copy nginx configuration
COPY config/nginx.conf /etc/nginx/nginx.conf
COPY config/conf.d/ /etc/nginx/conf.d/
COPY config/includes/ /etc/nginx/includes/
# Copy example site configurations as templates for reference
COPY config/sites/ /etc/nginx/sites.template/
# Copy the default blackhole config to active sites directory
COPY config/sites/00-default-blackhole.conf /etc/nginx/sites/00-default-blackhole.conf
# Copy custom HTML files
COPY html/ /usr/share/nginx/html/
# Set proper permissions
RUN chown -R nginx:nginx /usr/share/nginx/html \
&& chmod -R 755 /usr/share/nginx/html
# Expose standard HTTP and HTTPS ports
EXPOSE 80 443
# Add healthcheck
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -fsS http://127.0.0.1/healthz || exit 1
# Use the default nginx command
CMD ["nginx", "-g", "daemon off;"]