dj-embe/Dockerfile

48 lines
706 B
Docker
Raw Permalink Normal View History

2023-09-21 00:51:36 +02:00
FROM python:3.11.5-alpine as core
RUN --mount=type=cache,target=/var/cache/apk \
apk add poetry
2023-09-22 00:21:35 +02:00
FROM core as build
2023-09-20 21:57:07 +02:00
WORKDIR /app
2023-09-21 00:51:36 +02:00
RUN --mount=type=cache,target=/root/.cache/pip \
pip install poethepoet
2023-09-20 21:57:07 +02:00
2023-09-22 00:21:35 +02:00
COPY ./poetry.lock ./pyproject.toml ./poetry.toml ./
2023-09-20 21:57:07 +02:00
2023-09-22 00:21:35 +02:00
RUN --mount=type=cache,target=/root/.cache/pypoetry \
2023-09-21 00:51:36 +02:00
poetry install --sync
2023-09-20 21:57:07 +02:00
2023-09-21 00:51:36 +02:00
COPY ./test ./test
2023-09-20 21:57:07 +02:00
COPY ./dj-embe ./dj-embe
2023-09-22 00:21:35 +02:00
FROM build as check
2023-09-21 00:51:36 +02:00
RUN poe lint
2023-09-22 00:21:35 +02:00
FROM build as test
RUN poe test
FROM core as run
2023-09-21 00:51:36 +02:00
WORKDIR /app
2023-09-22 00:21:35 +02:00
COPY ./poetry.lock ./pyproject.toml ./poetry.toml ./
2023-09-21 00:51:36 +02:00
COPY ./dj-embe ./dj-embe
2023-09-22 00:21:35 +02:00
RUN --mount=type=cache,target=/root/.cache/pypoetry \
poetry install --without dev --sync
2023-09-21 00:51:36 +02:00
2023-09-20 21:57:07 +02:00
CMD poetry run python dj-embe