-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (33 loc) · 1.1 KB
/
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
33
34
35
36
37
38
39
40
41
# Use build layer
FROM python:3.10-alpine as builder
ENV POETRY_HOME=/opt/poetry
RUN if [ -z "${PYTHON_DOCKER_IMAGE##*alpine*}" ]; then \
echo "Installing required packages for alpine image"; \
apk update; \
apk add gcc musl-dev python3-dev libffi-dev openssl-dev curl; \
else \
echo "Skipping installation of required packages for alpine image"; \
fi
# Install poetry
RUN pip3 install --no-cache-dir --upgrade pip
RUN curl -sSL https://install.python-poetry.org | python3 -
# Use runtime layer
FROM python:3.10-alpine
# Disable creation of virtual environments to reduce image size
ENV POETRY_VIRTUALENVS_CREATE=false \
POETRY_HOME=/opt/poetry \
PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on
# Copy poetry into image
COPY --from=builder /opt/poetry /opt/poetry
ENV PATH="${POETRY_HOME}/bin:${PATH}"
WORKDIR /app
COPY poetry.lock pyproject.toml /app/
RUN pip3 install --no-cache-dir --upgrade pip
RUN poetry install
COPY ./cefies /app/cefies
COPY ./keys /app/keys
CMD ["fastapi", "run", "cefies/app.py", "--port", "80"]