rewrite
This commit is contained in:
80
Dockerfile
80
Dockerfile
@@ -1,49 +1,89 @@
|
||||
FROM python:3.14-rc-trixie
|
||||
|
||||
# ===== ENV VARIABLES =====
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
LABEL maintainer="HAProxy Manager" \
|
||||
version="2.0" \
|
||||
description="HAProxy Configuration Manager with SQLAlchemy"
|
||||
|
||||
# ===== INSTALL SYSTEM DEPENDENCIES =====
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
# HAProxy & SSL
|
||||
haproxy \
|
||||
supervisor \
|
||||
openssl \
|
||||
ca-certificates \
|
||||
\
|
||||
# Supervisord
|
||||
supervisor \
|
||||
\
|
||||
# Utilities
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
wget \
|
||||
git \
|
||||
vim \
|
||||
\
|
||||
# Development (for cryptography)
|
||||
libssl-dev \
|
||||
libffi-dev \
|
||||
python3-dev \
|
||||
build-essential \
|
||||
\
|
||||
# Cleanup
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get clean
|
||||
|
||||
# ===== WORKDIR =====
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements and install
|
||||
# ===== COPY & INSTALL PYTHON REQUIREMENTS =====
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN pip install --upgrade pip setuptools wheel && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application
|
||||
# ===== COPY APPLICATION FILES =====
|
||||
COPY app.py .
|
||||
COPY log_parser.py .
|
||||
|
||||
# Copy directory structure
|
||||
COPY config/ config/
|
||||
COPY database/ database/
|
||||
COPY routes/ routes/
|
||||
COPY utils/ utils/
|
||||
COPY auth/ auth/
|
||||
COPY templates/ templates/
|
||||
COPY static/ /app/static/
|
||||
COPY static/ static/
|
||||
|
||||
|
||||
# Create directories
|
||||
RUN mkdir -p /app/config/auth \
|
||||
&& mkdir -p /app/config/ssl \
|
||||
# ===== CREATE REQUIRED DIRECTORIES =====
|
||||
RUN mkdir -p /app/instance \
|
||||
&& mkdir -p /app/uploads/certificates \
|
||||
&& mkdir -p /app/backups \
|
||||
&& mkdir -p /app/logs \
|
||||
&& mkdir -p /etc/haproxy \
|
||||
&& mkdir -p /etc/supervisor/conf.d \
|
||||
&& mkdir -p /var/log/supervisor \
|
||||
&& mkdir -p /etc/haproxy
|
||||
&& mkdir -p /var/run/haproxy \
|
||||
&& touch /etc/haproxy/haproxy.cfg
|
||||
|
||||
# Copy configs
|
||||
# ===== COPY CONFIGS =====
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD curl -f https://localhost:5000 --insecure 2>/dev/null || exit 1
|
||||
# ===== SET PERMISSIONS =====
|
||||
RUN chmod +x /entrypoint.sh && \
|
||||
chmod 755 /app && \
|
||||
chmod -R 755 /app/uploads \
|
||||
chmod -R 755 /app/backups \
|
||||
chmod -R 755 /app/logs
|
||||
|
||||
# ===== EXPOSE PORTS =====
|
||||
EXPOSE 5000 80 443 8404
|
||||
|
||||
# ===== HEALTHCHECK =====
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD curl -f http://localhost:5000/api/current-user 2>/dev/null || exit 1
|
||||
|
||||
# ===== ENTRYPOINT =====
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user