Skip to content

Commit cb352eb

Browse files
authored
Merge pull request #1339 from finos/docker-build-and-upload-to-hub
feat: automatic Docker build and upload to Docker Hub
2 parents e186944 + 4767e78 commit cb352eb

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
docker-build-publish:
11+
name: Build and Publish Docker Image
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v3
17+
18+
- name: Checkout Repository
19+
uses: actions/checkout@v6
20+
21+
- name: Log in to Docker Hub
22+
if: github.repository == 'finos/git-proxy'
23+
uses: docker/login-action@v3
24+
with:
25+
username: finos
26+
password: ${{ secrets.DOCKER_PASSWORD }}
27+
28+
- name: Set Docker Image Tag
29+
id: tags
30+
run: |
31+
if [ "${{ github.event_name }}" = "release" ]; then
32+
echo "tags=finos/git-proxy:${{ github.ref_name }},finos/git-proxy:latest" >> $GITHUB_OUTPUT
33+
else
34+
echo "tags=finos/git-proxy:main" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Build and Publish Docker Image
38+
if: github.repository == 'finos/git-proxy'
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: .
42+
file: Dockerfile
43+
push: true
44+
tags: ${{ steps.tags.outputs.tags }}
45+
provenance: true

0 commit comments

Comments
 (0)