Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/buildImage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

env:
REGISTRY: ghcr.io
DOCKER_BUILDKIT: "1"

jobs:
build-image:
Expand All @@ -31,13 +32,13 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

# use the multistage docker build action instead of docker's action
- uses: firehed/multistage-docker-build-action@v1
- uses: firehed/multistage-docker-build-action@bc95fc29c4849d83e8473c7644900f559391d39c
id: build
with:
context: .
quiet: false
repository: ${{ env.REGISTRY }}/${{ github.repository }}/learn-maintenance-image-${{ matrix.python-version }}
tag-latest-on-default: true
stages: stage1, stage2
server-stage: stage3
build-args: |
PY_VERSION=${{ matrix.python-version }}
stages: stage1, stage3a
server-stage: stage3b
build-args: PY_VERSION=${{ matrix.python-version }}, MESSAGE="workflow"
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
ARG PY_VERSION=3.8
ARG MESSAGE="default messsage"
# syntax=docker/dockerfile:1

FROM python:$PY_VERSION AS stage1
ARG MESSAGE
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN echo stage1
RUN echo stage1 MESSAGE = ${MESSAGE}

FROM stage1 AS stage2
FROM stage1 AS stage2a
RUN echo stage2a MESSAGE = ${MESSAGE}

FROM stage2a AS stage2b
RUN echo stage2b MESSAGE = ${MESSAGE}

FROM stage1 AS stage3a
RUN pip install numpy
RUN echo stage2
RUN echo stage3a MESSAGE = ${MESSAGE}

FROM stage2 AS stage3
FROM stage3a AS stage3b
RUN pip install -U pytest coverage
COPY . .
RUN echo stage3b MESSAGE = ${MESSAGE}
RUN echo something