Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #9 from PDOK/fix_docker_build
Browse files Browse the repository at this point in the history
Fix broken (due to upstream changes) multistage build
  • Loading branch information
copierrj authored Oct 20, 2021
2 parents 1bae6ea + 7314983 commit 41859b2
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
FROM python:3.8-slim AS base
FROM python:3.8-slim
# We choose python-slim instead of alpine, a buildspeed vs image size tradeoff.

# In case you need base debian dependencies install them here.
# RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
# # TODO list depencies here \
# && apt-get clean && rm -rf /var/lib/apt/lists/*

# --- COMPILE-IMAGE ---
FROM base AS compile-image
ENV DEBIAN_FRONTEND=noninteractive

# Install dev dependencies
Expand All @@ -23,31 +21,13 @@ RUN pip install --no-cache-dir pipenv
WORKDIR /code
COPY . /code

# Install packages, including the dev (test) packages.
# Install packages
RUN PIPENV_VENV_IN_PROJECT=1 pipenv --three
RUN pipenv lock
RUN pipenv sync --dev
RUN pipenv sync

# Run pytest tests.
# pipenv check fails due to a github connection error. Pipenv check scans for python
# vulnerabilities amongst other things. We might want to debug and fix this:
# RUN PIPENV_PYUP_API_KEY="" pipenv check &&
#RUN pipenv run pytest

# Cleanup test packages. We want to use pipenv uninstall --all-dev but that command is
# broken. See: https://github.com/pypa/pipenv/issues/3722
RUN pipenv --rm && \
PIPENV_VENV_IN_PROJECT=1 pipenv --three && \
pipenv sync

# --- BUILD IMAGE ---
FROM base AS build-image
WORKDIR /code

COPY --from=compile-image "/code/linkage_checker.egg-info/" "/code/linkage_checker.egg-info/"
COPY --from=compile-image "/code/linkage_checker" "/code/linkage_checker"
COPY --from=compile-image /code/.venv /code/.venv

# Make sure we use the virtualenv:
ENV PATH="/code/.venv/bin:$PATH"

Expand Down

0 comments on commit 41859b2

Please sign in to comment.