Build Flask WAF log converter app

This commit is contained in:
Alfredo Di Stasio
2026-04-24 14:40:32 +02:00
parent f9579bd253
commit 355d61f11f
23 changed files with 1053 additions and 1 deletions

37
Dockerfile Normal file
View File

@@ -0,0 +1,37 @@
FROM python:3.12-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
COPY pyproject.toml README.md ./
COPY app ./app
COPY tests ./tests
COPY wsgi.py ./
RUN useradd --create-home appuser && \
mkdir -p /app/instance/outputs && \
chown -R appuser:appuser /app
FROM base AS production
ENV OUTPUT_DIRECTORY=/app/instance/outputs
RUN pip install --no-cache-dir .
USER appuser
EXPOSE 8000
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--threads", "4", "wsgi:app"]
FROM base AS test
ENV OUTPUT_DIRECTORY=/app/instance/outputs
RUN pip install --no-cache-dir ".[dev]"
USER appuser
CMD ["python", "-m", "pytest"]