-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
36 lines (29 loc) · 1.02 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
FROM python:3.12-alpine
# Setup environment variables:
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.8.2 \
RUNNING_IN_DOCKER=true \
# Store the venv in project directory: /app/.venv
POETRY_VIRTUALENVS_CREATE=0 \
# Set the cache directory for poetry and pip
# This is useful when you want to cache dependencies between builds
POETRY_CACHE_DIR=/tmp/poetry_cache \
BASE_PATH=/
# System deps:
RUN --mount=type=cache,target=/var/cache/apk \
apk add --update \
gcc libc-dev linux-headers libffi-dev
RUN pip install "poetry==$POETRY_VERSION"
# Copy only requirements to cache them in docker layer
WORKDIR /code
COPY poetry.lock pyproject.toml /code/
# Project initialization:
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --no-interaction --no-ansi --without dev
# Creating folders, and files for a project:
COPY . /code
CMD python main.py