-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
23 lines (20 loc) · 812 Bytes
/
Copy pathDockerfile.backend
File metadata and controls
23 lines (20 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app/backend
WORKDIR /app
COPY pyproject.toml ./
RUN python -m pip install --upgrade pip
RUN --mount=type=cache,target=/root/.cache/pip \
python -c "import tomllib; deps = tomllib.load(open('pyproject.toml', 'rb'))['project']['dependencies']; open('/tmp/requirements.txt', 'w').write('\n'.join(deps))" && \
for attempt in 1 2 3; do \
pip install --retries 10 --timeout 120 -r /tmp/requirements.txt && break; \
if [ "$attempt" = "3" ]; then exit 1; fi; \
echo "pip install failed; retrying ($attempt/3)"; \
sleep 5; \
done
COPY backend ./backend
COPY scripts ./scripts
RUN pip install --no-deps .
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]