File tree Expand file tree Collapse file tree 1 file changed +30
-17
lines changed Expand file tree Collapse file tree 1 file changed +30
-17
lines changed Original file line number Diff line number Diff line change @@ -3,35 +3,48 @@ name: Test Docker Image
33# TODO: set docker auth
44on :
55 workflow_dispatch :
6- # on:
7- # push:
8- # tags:
9- # - "v*"
10-
11- env :
12- IMAGE : nemoguardrails
13- TEST_TAG : ${{ env.IMAGE }}:test
14- LATEST_TAG : ${{ env.IMAGE }}:latest
6+ schedule :
7+ - cron : " 0 0 * * 0"
8+ push :
9+ tags :
10+ - " v*"
11+ pull_request :
12+ paths :
13+ - " Dockerfile"
14+ - " pyproject.toml"
15+ - " poetry.lock"
16+ - " .github/workflows/test-docker.yml"
1517
1618jobs :
1719 docker :
1820 runs-on : ubuntu-latest
21+ env :
22+ IMAGE : nemoguardrails
1923 steps :
2024 #
2125 # Checkout the code
2226 - name : Checkout
2327 uses : actions/checkout@v4
2428
25- # Extract the tag version and set Docker tags
26- - name : Get git tag and set Docker tags
29+ # Get runner architecture
30+ - name : Get runner architecture
31+ id : runner-arch
32+ run : echo "arch=$(uname -m)" >> $GITHUB_OUTPUT
33+
34+ - name : Set Docker tags
2735 run : |
28- VERSION=${GITHUB_REF#refs/tags/v}
29- echo "VERSION=$VERSION" >> $GITHUB_ENV
30- echo "VERSION_TAG=${{ env.IMAGE }}:$VERSION" >> $GITHUB_ENV
36+ ARCH=${{ steps.runner-arch.outputs.arch }}
37+ echo "TEST_TAG=${{ env.IMAGE }}:${{ github.sha }}-$ARCH" >> $GITHUB_ENV
3138
32- # Build the Docker image
33- - name : Build the Docker image
34- run : docker build . --file Dockerfile --tag ${{ env.TEST_TAG }} --tag ${{ env.VERSION_TAG }}
39+ - name : Set up Docker Buildx
40+ uses : docker/setup-buildx-action@v3
41+ - name : Build image
42+ uses : docker/build-push-action@v6
43+ with :
44+ context : .
45+ file : Dockerfile
46+ load : true
47+ tags : ${{ env.TEST_TAG }}
3548
3649 # Start the container in detached mode
3750 - name : Start container
You can’t perform that action at this time.
0 commit comments