feat: Add Docker workflows for building, testing, and deploying the application; include Dockerfile for image creation

This commit is contained in:
2025-10-23 17:06:14 +02:00
parent 8aee7b0d74
commit 119bbcc7a8
5 changed files with 125 additions and 0 deletions

31
Dockerfile Normal file
View File

@@ -0,0 +1,31 @@
# Multi-stage Dockerfile to keep final image small
FROM python:3.10-slim AS builder
# Install build-time packages and Python dependencies in one layer
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential gcc libpq-dev \
&& python -m pip install --upgrade pip \
&& pip install --no-cache-dir --prefix=/install -r /app/requirements.txt \
&& apt-get purge -y --auto-remove build-essential gcc \
&& rm -rf /var/lib/apt/lists/*
FROM python:3.10-slim
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
# Production environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# Copy application code
COPY . /app
# Expose service port
EXPOSE 8000
# Run the FastAPI app with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]