forked from ostaubli/devops_project
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
23 lines (16 loc) · 809 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
# Start from a base-image containing Python 3.11 ("slim" is a minimal OS version)
FROM python:3.11-slim
# Defines the target "working" directory to be "/code"
WORKDIR /code
# Copies the file requirements.txt into the "/code" directory
COPY ./requirements.txt /code/requirements.txt
# Install requirements ("--no-cache-dir" to keep a Docker image as small as possible)
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy all source code from "/src" to the image
COPY ./server /code/server
# Extend "PYTHONPATH" to reference code outside main.py
ENV PYTHONPATH="$PATH:/code"
# Expose port for request from outside container
EXPOSE 8080
# Use "uvicorn" to start FastAPI service from main.py on exposed port
CMD ["uvicorn", "server.py.main:app", "--host", "0.0.0.0", "--port", "8080"]