dj-embe/Dockerfile

48 lines
706 B
Docker
Raw Permalink Normal View History

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