File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and Push Docker image to GHCR
2+
3+ on :
4+ push :
5+ branches :
6+ - feat/dockerfile-database-init
7+ paths :
8+ - " pg/**"
9+ - " Dockerfile-database-init"
10+ workflow_dispatch :
11+
12+ env :
13+ REGISTRY : ghcr.io
14+ IMAGE_NAME : ${{ github.repository }}
15+
16+ jobs :
17+ build-and-push :
18+ runs-on : ubuntu-latest
19+ permissions :
20+ contents : read
21+ packages : write
22+
23+ steps :
24+ - name : Checkout repository
25+ uses : actions/checkout@v4
26+
27+ - name : Log in to GitHub Container Registry
28+ uses : docker/login-action@v3
29+ with :
30+ registry : ${{ env.REGISTRY }}
31+ username : ${{ github.actor }}
32+ password : ${{ secrets.GITHUB_TOKEN }}
33+
34+ - name : Extract metadata (tags, labels)
35+ id : meta
36+ uses : docker/metadata-action@v5
37+ with :
38+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+ tags : |
40+ type=sha,prefix=sha-
41+ type=ref,event=branch
42+ type=raw,value=latest,enable={{is_default_branch}}
43+
44+ - name : Set up Docker Buildx
45+ uses : docker/setup-buildx-action@v3
46+
47+ - name : Build and push Docker image
48+ uses : docker/build-push-action@v5
49+ with :
50+ context : .
51+ file : Dockerfile-database-init
52+ push : true
53+ tags : ${{ steps.meta.outputs.tags }}
54+ labels : ${{ steps.meta.outputs.labels }}
55+ cache-from : type=gha
56+ cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change 1+ FROM postgres:17
2+
3+ COPY pg/ /pg/
4+
5+ RUN chmod +x /pg/lancement.sh
6+
7+ ENTRYPOINT ["/pg/lancement.sh"]
You can’t perform that action at this time.
0 commit comments