-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (32 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
44 lines (32 loc) · 1.37 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
#########################################################################################
# Setup Base Environment
#########################################################################################
FROM python:3.10-slim-buster as base
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV OPENAPI_URL ""
EXPOSE 5678
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /home/portfolio
COPY requirements.txt .
RUN pip install --upgrade setuptools pip && \
pip install -r requirements.txt && \
rm requirements.txt
ENTRYPOINT [ "/bin/bash" ]
#########################################################################################
# Build Runtime Package
#########################################################################################
FROM base as builder
COPY . .
RUN pip install -r requirements-dev.txt && \
python -m build --wheel
#########################################################################################
# Install Runtime package
#########################################################################################
FROM base as runtime
COPY --from=builder /home/portfolio/dist/ build/
RUN find build/ -maxdepth 1 -name "*.tar.gz" -o -name "*.whl" | xargs -r -n1 -t pip install && \
rm -r build/
ENTRYPOINT ["uvicorn", "portfolio.main:app", "--host=0.0.0.0", "--port=5678"]