-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (27 loc) · 1018 Bytes
/
Copy pathDockerfile
File metadata and controls
35 lines (27 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
DATABASE_URL=sqlite:////data/mlb_visualizer.db \
PYTHONPATH=/app
WORKDIR /app
RUN pip install --no-cache-dir poetry==1.8.3
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root --only main
COPY alembic.ini ./
COPY alembic ./alembic
COPY app ./app
COPY scripts ./scripts
COPY docker-entrypoint.sh ./
RUN chmod +x docker-entrypoint.sh
# Dedicated volume mount point so persisted data survives container
# recreation without a bind mount clobbering the application code in /app.
RUN mkdir -p /data
VOLUME ["/data"]
EXPOSE 8000
# The entrypoint applies migrations (idempotent) before running whatever
# command was given, so overriding CMD to run an import script still lands
# on a migrated schema rather than skipping the migration step.
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]