-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (20 loc) · 704 Bytes
/
Dockerfile
File metadata and controls
26 lines (20 loc) · 704 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
FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Virtual environment
ENV VIRTUAL_ENV="/opt/venv"
RUN python3 -m venv "${VIRTUAL_ENV}"
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
# Requirements
COPY ./requirements/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r "/tmp/requirements.txt" \
&& rm -f /tmp/requirements.txt
# Code
WORKDIR /CODE
COPY ./src/app /CODE/app
# Bytecode optimizations
RUN python -c "import compileall; compileall.compile_path(maxlevels=10)" \
&& python -m compileall /CODE/app
ENTRYPOINT ["uvicorn"]
CMD ["app.main:app", "--host", "0.0.0.0", "--port", "8000"]