diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c7e157f3e7..a88c0069c4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -27,7 +27,8 @@ jobs: - name: Lint with Black run: | black --check --diff --verbose . + - name: Lint Dockerfile - uses: brpaz/hadolint-action@v1.1.0 + uses: hadolint/hadolint-action@v1.5.0 with: - dockerfile: "docker/Dockerfile" + dockerfile: docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile index e833cbfc97..52c596fe3d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,6 +3,8 @@ ARG BASE_IMAGE=python:3.8-slim FROM ${BASE_IMAGE} as base FROM base as builder +# Set PATH to pickup virtual environment by default +ENV PATH=/usr/local/venv/bin:"${PATH}" COPY . /code # hadolint ignore=DL3003,SC2102 RUN apt-get -qq -y update && \ @@ -11,17 +13,19 @@ RUN apt-get -qq -y update && \ apt-get -y autoclean && \ apt-get -y autoremove && \ rm -rf /var/lib/apt/lists/* && \ + python -m venv /usr/local/venv && \ cd /code && \ python -m pip --no-cache-dir install --upgrade pip setuptools wheel && \ python -m pip --no-cache-dir install .[xmlio,contrib] && \ python -m pip list FROM base +ENV PATH=/usr/local/venv/bin:"${PATH}" RUN apt-get -qq -y update && \ apt-get -qq -y install --no-install-recommends \ curl && \ apt-get -y autoclean && \ apt-get -y autoremove && \ rm -rf /var/lib/apt/lists/* -COPY --from=builder /usr/local /usr/local -ENTRYPOINT ["/usr/local/bin/pyhf"] +COPY --from=builder /usr/local/venv /usr/local/venv +ENTRYPOINT ["/usr/local/venv/bin/pyhf"]