Skip to content

Commit 56822cd

Browse files
Merge pull request #13 from cloudinary/add-github-action-for-build-and-push-to-dockerhub
1 parent 11ddfcf commit 56822cd

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
env:
12+
IMAGE_NAME: cloudinary/asset-management-mcp
13+
14+
steps:
15+
- name: Check out repository
16+
uses: actions/checkout@v4
17+
18+
- name: Extract short SHA
19+
id: sha
20+
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
21+
22+
- name: Set up QEMU (for multi-arch)
23+
uses: docker/setup-qemu-action@v3
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
with:
28+
install: true
29+
30+
- name: Log in to Docker Hub
31+
uses: docker/login-action@v2
32+
with:
33+
username: ${{ secrets.DOCKERHUB_USERNAME }}
34+
password: ${{ secrets.DOCKERHUB_TOKEN }}
35+
36+
- name: Build and push image
37+
uses: docker/build-push-action@v4
38+
with:
39+
context: .
40+
push: true
41+
platforms: linux/amd64,linux/arm64
42+
cache-from: type=gha
43+
cache-to: type=gha,mode=max
44+
tags: |
45+
${{ env.IMAGE_NAME }}:${{ github.event_name == 'release' && github.event.release.tag_name || steps.sha.outputs.sha }}
46+
${{ env.IMAGE_NAME }}:${{ steps.sha.outputs.sha }}
47+
${{ env.IMAGE_NAME }}:latest

0 commit comments

Comments
 (0)