2026-02-05 07:36:25 +03:00
|
|
|
FROM python:3.12-alpine
|
|
|
|
|
|
|
|
|
|
# Install OpenVPN, OpenRC and other system deps
|
2026-02-07 14:16:49 +03:00
|
|
|
RUN apk add --no-cache openvpn openrc iproute2 bash iptables easy-rsa
|
|
|
|
|
|
2026-02-05 07:36:25 +03:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install Python dependencies
|
|
|
|
|
COPY requirements.txt .
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
2026-02-07 14:01:20 +03:00
|
|
|
# Ensure DB directory exists
|
2026-10-07 09:38:09 +03:00
|
|
|
RUN mkdir -p /app/db /app/backups
|
|
|
|
|
|
|
|
|
|
# Migrations of the monitoring database (standard library only), from the build context 'core'
|
|
|
|
|
# (additional_contexts in docker-compose.yml). A restore migrates the package copy with them.
|
|
|
|
|
COPY --from=core migrations.py migrate.py db.py /opt/core/
|
|
|
|
|
ENV OVPMON_CORE_DIR=/opt/core
|
2026-02-07 14:01:20 +03:00
|
|
|
|
2026-02-05 07:36:25 +03:00
|
|
|
# Copy source code and entrypoint
|
|
|
|
|
COPY . .
|
2026-02-07 14:01:20 +03:00
|
|
|
|
2026-02-05 07:36:25 +03:00
|
|
|
RUN chmod +x entrypoint.sh
|
|
|
|
|
|
|
|
|
|
# Expose API port
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
# Expose OpenVPN port (default 1194 UDP)
|
|
|
|
|
EXPOSE 1194/udp
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|