-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
32 lines (24 loc) · 912 Bytes
/
Dockerfile
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
# Use Python 3.11 slim image as a base to avoid manual installations
FROM python:3.11-slim as builder
# Set the working directory in the container
WORKDIR /app
# Install build dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Use pip wheel to build dependencies first
COPY Pipfile Pipfile.lock ./
# Use pipenv to lock the dependencies to a requirements.txt
RUN pip install pipenv && \
pipenv requirements > requirements.txt
# Install Python dependencies in /.venv
RUN pip install -r requirements.txt
RUN python -c "import certifi; print(certifi.where())"
# Copy the rest of the code to the working directory
COPY . /app
# Expose port 8080
EXPOSE 8080
# Run the command to start uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"]