1+ name : Create and publish a Docker image
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths-ignore :
8+ - ' **.md'
9+ - ' CITATION.cff'
10+ - ' LICENSE'
11+ - ' .gitignore'
12+ - ' docs/**'
13+ pull_request :
14+ branches :
15+ - main
16+ paths-ignore :
17+ - ' **.md'
18+ - ' CITATION.cff'
19+ - ' LICENSE'
20+ - ' .gitignore'
21+ - ' docs/**'
22+ workflow_dispatch :
23+ inputs :
24+ manual_revision_reference :
25+ required : false
26+ type : string
27+ manual_revision_test :
28+ required : false
29+ type : string
30+
31+ env :
32+ REGISTRY : ghcr.io
33+ IMAGE_NAME : ${{ github.repository }}
34+
35+ jobs :
36+ build-and-push-image :
37+ runs-on : ubuntu-latest
38+ permissions :
39+ contents : read
40+ packages : write
41+
42+ steps :
43+ - name : Checkout repository
44+ uses : actions/checkout@v3
45+
46+ - name : Set up Docker Buildx
47+ uses : docker/setup-buildx-action@v2
48+
49+ - name : Log in to the Container registry
50+ uses : docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
51+ with :
52+ registry : ${{ env.REGISTRY }}
53+ username : ${{ github.actor }}
54+ password : ${{ secrets.GITHUB_TOKEN }}
55+
56+ - name : Extract metadata (tags, labels) for Docker
57+ id : meta
58+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
59+ with :
60+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
61+
62+ - name : Build & push training Docker image
63+ id : build-and-push-training
64+ uses : docker/build-push-action@v4
65+ with :
66+ context : .
67+ push : true
68+ tags : ${{ steps.meta.outputs.tags }}
69+ labels : ${{ steps.meta.outputs.labels }}
70+ file : Dockerfile.training
71+
72+ - name : Build and push test Docker image
73+ id : build-and-push-test
74+ uses : docker/build-push-action@v4
75+ with :
76+ context : .
77+ push : true
78+ tags : ${{ steps.meta.outputs.tags }}-test
79+ labels : ${{ steps.meta.outputs.labels }}
80+ file : Dockerfile.test
0 commit comments