File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed
Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and publish Docker image to GHCR
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ release :
7+ types : [ created ]
8+
9+ permissions :
10+ contents : read
11+ packages : write
12+
13+ jobs :
14+ build-and-push :
15+ runs-on : ubuntu-latest
16+ env :
17+ IMAGE_NAME : braindrive-document-ai
18+ REGISTRY : ghcr.io
19+ REPO : ${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
20+
21+ steps :
22+ - name : Checkout
23+ uses : actions/checkout@v4
24+
25+ - name : Set up Docker Buildx
26+ uses : docker/setup-buildx-action@v3
27+
28+ - name : Log into GHCR
29+ uses : docker/login-action@v3
30+ with :
31+ registry : ghcr.io
32+ username : ${{ github.actor }}
33+ password : ${{ secrets.GITHUB_TOKEN }}
34+
35+ - name : Cache Docker layers (buildx)
36+ uses : actions/cache@v4
37+ with :
38+ path : /tmp/.buildx-cache
39+ key : buildx-cache-${{ github.sha }}
40+ restore-keys : |
41+ buildx-cache-
42+
43+ - name : Build and push
44+ uses : docker/build-push-action@v6
45+ with :
46+ context : .
47+ file : ./Dockerfile
48+ push : true
49+ platforms : linux/amd64,linux/arm64
50+ tags : |
51+ ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
52+ ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
53+ cache-from : type=gha
54+ cache-to : type=gha,mode=max
55+ build-args : |
56+ ENABLE_CUDA=${{ inputs.enable_cuda || 'false' }}
57+
58+ - name : Upload image digest to artifacts
59+ if : success()
60+ run : echo "Image pushed: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest"
You can’t perform that action at this time.
0 commit comments