Skip to content

Commit

Permalink
update docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
alavenant committed Jul 15, 2024
1 parent 4b88886 commit f8183b1
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/cicd_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v4

# build "local" and test before build and deploy
- name: Build docker image
run: docker build -t ${{ env.DOCKER_IMAGE_NAME }}:test .
# build the image
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
load: true
tags: test

# run the test on the docker build
- name: Run tests in docker image
run: docker run ${{ env.DOCKER_IMAGE_NAME }}:test python -m pytest

Expand All @@ -43,6 +49,7 @@ jobs:
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
if: github.event_name != 'pull_request'
id: meta
uses: docker/metadata-action@v5
with:
Expand All @@ -59,13 +66,3 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# pull and test
- name : Pull Docker image
id: pull-image
if: github.event_name != 'pull_request'
run: docker pull ${{ steps.meta.outputs.tags }}
- name : Test Docker image
id: test-image
if: github.event_name != 'pull_request'
run: docker run ${{ steps.meta.outputs.tags }} python -m pytest

0 comments on commit f8183b1

Please sign in to comment.