This commit is contained in:
pika 2025-03-25 23:41:13 +01:00
commit 66f9ce3614
33 changed files with 2271 additions and 0 deletions

33
Dockerfile Normal file
View file

@ -0,0 +1,33 @@
# Use Python 3.9 slim image
FROM python:3.9-slim
# Set working directory
WORKDIR /app
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV FLASK_APP app
ENV FLASK_ENV production
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python packages
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create a non-root user to run the application
RUN adduser --disabled-password --gecos "" netviz
RUN chown -R netviz:netviz /app
USER netviz
# Run gunicorn with 4 workers
CMD gunicorn --bind 0.0.0.0:5000 --workers 4 "app:create_app()"