Files
school_compare/Dockerfile
T

37 lines
1.0 KiB
Docker
Raw Normal View History

2026-01-06 13:52:00 +00:00
# syntax=docker/dockerfile:1
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
2026-01-06 17:15:43 +00:00
# Install curl for healthcheck and libpq for PostgreSQL
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
libpq5 \
2026-01-06 13:52:00 +00:00
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install dependencies first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY backend/ ./backend/
2026-01-06 17:15:43 +00:00
COPY scripts/ ./scripts/
2026-01-06 13:52:00 +00:00
ARG BUILD_SHA=development
ARG BUILD_ID=development
LABEL io.schoolcompare.build-id=$BUILD_ID
LABEL io.schoolcompare.commit=$BUILD_SHA
RUN python -c 'import json,sys; open("backend/build-info.json", "w").write(json.dumps({"sha":sys.argv[1],"build_id":sys.argv[2]}))' "$BUILD_SHA" "$BUILD_ID"
2026-01-06 13:52:00 +00:00
# Expose the application port
EXPOSE 80
2026-01-06 16:30:32 +00:00
# Run the application (using module import)
CMD ["python", "-m", "uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "80"]