-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 869 Bytes
/
Dockerfile
File metadata and controls
31 lines (23 loc) · 869 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
27
28
29
30
31
FROM python:3.10-alpine
WORKDIR /app
# Install build dependencies (gcc, etc.)
RUN apk update \
&& apk --no-cache --update add build-base libffi-dev openssl-dev
# Set poetry version to use
ARG POETRY_VERSION=1.4.0
# Prevent Python from generating .pyc files
ENV PYTHONDONTWRITEBYTECODE 1
# Turn off stdout/stderr buffering to make output appear in real time
ENV PYTHONUNBUFFERED 1
# Set pip env vars for faster/leaner docker builds
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1
RUN pip install "poetry==$POETRY_VERSION"
# Install dependencies first to leverage Docker layer caching
ADD poetry.lock pyproject.toml ./
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
# After dependencies are installed, copy the rest of the code
ADD . .
ENTRYPOINT ["python", "main.py"]