Ajout d'un logrotate pour les logs de nginx
This commit is contained in:
		
							
								
								
									
										18
									
								
								deployment/Dockerfile-nginx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								deployment/Dockerfile-nginx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
FROM nginx:latest
 | 
			
		||||
 | 
			
		||||
RUN apt-get update && \
 | 
			
		||||
    apt-get install -y logrotate cron && \
 | 
			
		||||
    rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
RUN rm -f /var/log/nginx/access.log /var/log/nginx/error.log
 | 
			
		||||
RUN chmod 755 /var/log/nginx
 | 
			
		||||
RUN chown root:nginx /var/log/nginx
 | 
			
		||||
 | 
			
		||||
COPY deployment/scripts/nginx/nginx.logrotate /etc/logrotate.d/nginx
 | 
			
		||||
RUN chmod 644 /etc/logrotate.d/nginx
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPY deployment/scripts/nginx/entrypoint.sh /entrypoint.sh
 | 
			
		||||
RUN chmod +x /entrypoint.sh
 | 
			
		||||
 | 
			
		||||
CMD ["/entrypoint.sh"]
 | 
			
		||||
							
								
								
									
										4
									
								
								deployment/scripts/nginx/entrypoint.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								deployment/scripts/nginx/entrypoint.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
cron
 | 
			
		||||
 | 
			
		||||
nginx -g 'daemon off;'
 | 
			
		||||
							
								
								
									
										14
									
								
								deployment/scripts/nginx/nginx.logrotate
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								deployment/scripts/nginx/nginx.logrotate
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
/var/log/nginx/*.log {
 | 
			
		||||
    su root nginx
 | 
			
		||||
    daily
 | 
			
		||||
    missingok
 | 
			
		||||
    rotate 7
 | 
			
		||||
    compress
 | 
			
		||||
    delaycompress
 | 
			
		||||
    notifempty
 | 
			
		||||
    create 640 root nginx
 | 
			
		||||
    sharedscripts
 | 
			
		||||
    postrotate
 | 
			
		||||
        [ -f /run/nginx.pid ] && kill -USR1 `cat /run/nginx.pid`
 | 
			
		||||
    endscript
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user