Skip to content

Commit

Permalink
Clean up unused test fluff from docker
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonj04 committed Oct 30, 2023
1 parent e526abd commit 30db20f
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
FROM python:3.12 as builder
FROM python:3.12 as service

RUN pip install poetry==1.6.1

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
POETRY_VIRTUALENVS_CREATE=1

WORKDIR /app

COPY pyproject.toml poetry.lock ./
RUN touch README.md

RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --with dev --no-root

FROM python:3.12 as test_runner

ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY src ./tests
COPY tests ./tests

WORKDIR tests

# run tests
RUN poetry run pytest .

FROM python:3.12 as service
RUN poetry install --without dev --no-root

ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY src .

0 comments on commit 30db20f

Please sign in to comment.