-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (26 loc) · 833 Bytes
/
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
FROM docker.io/library/python:3.12 AS base
ARG APP_VERSION=0.0.0
ARG APP_COMMIT=0000000000
ENV PYTHONUNBUFFERED=1
FROM base AS builder
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1
# Setup build environment
RUN pip install poetry
RUN python -m venv /venv
# Install python dependencies into virtual environment
COPY pyproject.toml poetry.lock ./
RUN . /venv/bin/activate && poetry install --sync --without dev --no-root
FROM base AS final
# Copy python dependencies
COPY --from=builder /venv /venv
# Copy application files
WORKDIR /app
COPY . .
# Add application version/commit info
RUN echo "VERSION = '$APP_VERSION' \nCOMMIT = '$(echo $APP_COMMIT | head -c 10)'" > version.py
# Set entrypoint
RUN chmod +x entrypoint.sh
ENTRYPOINT [ "/bin/bash", "/app/entrypoint.sh" ]
CMD []