-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
31 lines (21 loc) · 800 Bytes
/
Dockerfile.backend
File metadata and controls
31 lines (21 loc) · 800 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
FROM python:3.11-slim
LABEL maintainer="ml-pricer <support@example.com>"
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
RUN adduser --disabled-password --gecos "" appuser
WORKDIR /srv/app
# Install minimal system deps that many Python packages need
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential gcc git \
&& rm -rf /var/lib/apt/lists/*
# Copy only requirements first to leverage Docker cache
COPY requirements.txt ./
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Copy app code
COPY . /srv/app
RUN chown -R appuser:appuser /srv/app
USER appuser
EXPOSE 8000
# Uvicorn runs the FastAPI backend. Make sure `app.backend:app` is the correct import path.
CMD ["uvicorn", "app.backend:app", "--host", "0.0.0.0", "--port", "8000"]