forked from OurHike/OurHike
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (27 loc) · 1.31 KB
/
Copy pathDockerfile
File metadata and controls
32 lines (27 loc) · 1.31 KB
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
# Production image for the OurHike FastAPI backend.
#
# Migrations are deliberately NOT run automatically on container start -
# `alembic upgrade head` is a separate, reviewed step (see README.md), not
# something that fires unattended on every deploy/restart. A bad migration
# should never be able to block the app from starting, and multiple
# instances starting simultaneously should never race on schema changes.
#
# Matches the Python version pinned in .github/workflows/backend-tests.yml
# and pipeline-tests.yml, so local/CI/production all run the same interpreter.
FROM python:3.14-slim
WORKDIR /app
# Install dependencies first, separately from app code, so this layer only
# rebuilds when requirements.txt actually changes - not on every code edit.
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app/ ./app/
COPY alembic/ ./alembic/
COPY alembic.ini .
# Most PaaS hosts inject PORT at runtime rather than trusting a fixed value
# baked into the image - default to 8000 for any host/local run that doesn't
# set it. This one line is what makes the image portable across Render,
# Railway, Koyeb, Cloud Run and the rest, which is why there is no
# host-specific config file beside it (see HOSTING.md).
ENV PORT=8000
EXPOSE 8000
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"]