81 lines
2.0 KiB
Docker
81 lines
2.0 KiB
Docker
FROM python:3.14-rc-trixie
|
|
|
|
# ===== ENV VARIABLES =====
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
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 \
|
|
openssl \
|
|
ca-certificates \
|
|
supervisor \
|
|
curl \
|
|
wget \
|
|
git \
|
|
vim \
|
|
libssl-dev \
|
|
libffi-dev \
|
|
python3-dev \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& apt-get clean
|
|
|
|
# ===== WORKDIR =====
|
|
WORKDIR /app
|
|
|
|
# ===== COPY & INSTALL PYTHON REQUIREMENTS =====
|
|
COPY requirements.txt .
|
|
RUN pip install --upgrade pip setuptools wheel && \
|
|
pip install --no-cache-dir -r requirements.txt
|
|
|
|
# ===== 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/ static/
|
|
|
|
# ===== 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 /var/run/haproxy \
|
|
&& touch /etc/haproxy/haproxy.cfg
|
|
|
|
# ===== COPY CONFIGS =====
|
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
|
|
# ===== SET PERMISSIONS (POPRAWIONE - && ВЕЗДЕ!) =====
|
|
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"]
|