File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Docker Image CI
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ pull_request :
7+ branches : ["main"]
8+
9+ env :
10+ IMAGE_NAME : shiny-meets-fastapi
11+ VERSION : latest
12+ CONTEXT : routes_example_app
13+
14+ jobs :
15+ build :
16+ runs-on : ubuntu-latest
17+
18+ steps :
19+ - uses : actions/checkout@v4
20+ - name : Build the Docker image
21+ run : |
22+ cd $CONTEXT
23+ docker build . --file Dockerfile --tag $IMAGE_NAME:$VERSION
24+
25+ - name : Log in to registry
26+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u token --password-stdin
27+
28+ - name : Push image to ghcr.io
29+ run : |
30+ image_id=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
31+ # repository name must be lowercase
32+ image_id=$(echo $image_id | tr '[A-Z]' '[a-z]')
33+ docker tag $IMAGE_NAME:$VERSION $image_id:$VERSION
34+ docker push $image_id:$VERSION
You can’t perform that action at this time.
0 commit comments