good final Dockerfile

This commit is contained in:
Grégory Lebreton 2024-09-19 16:12:30 +02:00
parent 9217cb9ecf
commit 6847f349e0
2 changed files with 38 additions and 6 deletions

View File

@ -1,11 +1,16 @@
FROM nginx:1.21.6-alpine
LABEL maintainer="greg.lebreton@hotmail.com"
FROM nginx:mainline-alpine
COPY nginx.conf /etc/nginx/nginx.conf
COPY ./html /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html && chmod -R 755 /usr/share/nginx/html && \
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
chown -R nginx:nginx /etc/nginx/conf.d
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid
USER nginx
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD curl -f http://localhost/ || exit 1
CMD ["nginx", "-g", "daemon off;"]

27
nginx.conf Normal file
View File

@ -0,0 +1,27 @@
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}