2025-02-19 07:53:26 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								FROM python:3.12-slim
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-11 06:24:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN apt update -y && apt dist-upgrade -y && apt install socat haproxy cron certbot curl jq -y && apt clean && rm -rf /var/lib/apt/lists/*
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-19 07:53:26 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WORKDIR /haproxy
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								COPY ./templates /haproxy/templates
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								COPY requirements.txt /haproxy/
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								COPY haproxy_manager.py /haproxy/
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-20 13:41:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								COPY scripts /haproxy/scripts
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN chmod +x /haproxy/scripts/*
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-19 07:53:26 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN pip install -r requirements.txt
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 14:49:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN echo "0 */12 * * * root test -x /usr/bin/certbot && /usr/bin/certbot -q renew && echo \"reload\" | socat stdio /tmp/haproxy-cli" > /var/spool/cron/crontabs/root
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-11 06:24:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Create log directories
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN mkdir -p /var/log && touch /var/log/haproxy-manager.log /var/log/haproxy-manager-errors.log
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN chmod 755 /var/log/haproxy-manager.log /var/log/haproxy-manager-errors.log
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-19 07:53:26 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								EXPOSE 80 443 8000
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-20 13:41:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Add health check
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    CMD curl -f http://localhost:8000/health || exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CMD ["/haproxy/scripts/start-up.sh"]
							 |