language-learning-app/api/Dockerfile

33 lines
1 KiB
Docker
Raw Permalink Normal View History

FROM python:3.13-slim
2026-03-18 20:55:02 +00:00
WORKDIR /app
# install pq (libpq5) - a driver for postgres
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq5 \
&& rm -rf /var/lib/apt/lists/*
2026-03-18 20:55:02 +00:00
# Install uv for fast, reproducible installs
RUN pip install --no-cache-dir uv alembic procrastinate psycopg2-binary
2026-03-18 20:55:02 +00:00
# Install Python dependencies from pyproject.toml
COPY pyproject.toml .
RUN --mount=type=cache,target=/root/.cache/pip \
uv pip install --no-cache-dir --system --requirements pyproject.toml
2026-03-18 20:55:02 +00:00
# Download spaCy language models
RUN --mount=type=cache,target=/root/.cache/pip \
python -m spacy download en_core_web_sm && \
2026-03-18 20:55:02 +00:00
python -m spacy download fr_core_news_sm && \
python -m spacy download es_core_news_sm && \
python -m spacy download it_core_news_sm && \
python -m spacy download de_core_news_sm
# Copy application source and migrations
2026-03-18 20:55:02 +00:00
COPY app/ ./app/
COPY alembic/ ./alembic/
COPY alembic.ini .
2026-03-18 20:55:02 +00:00
EXPOSE 8000
CMD ["sh", "-c", "alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000"]