initial commit
All checks were successful
Build and Push Image / build-and-push (push) Successful in 1m26s

This commit is contained in:
Michael Trip 2026-01-09 21:58:53 +01:00
parent 3bba1f6db6
commit b56e866071
36 changed files with 4160 additions and 0 deletions

50
Dockerfile Normal file
View file

@ -0,0 +1,50 @@
# Snauw Counter - Productie-waardige Flask applicatie
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
FLASK_APP=run.py \
FLASK_ENV=production
# Set work directory
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
COPY requirements-prod.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements-prod.txt
# Create non-root user for security
RUN groupadd -r appuser && useradd -r -g appuser appuser
# Copy application code
COPY . .
# Create necessary directories and set permissions
RUN mkdir -p /app/instance /app/logs \
&& chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:5000/health || exit 1
# Expose port
EXPOSE 5000
# Run application with Gunicorn for production
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "run:app"]