Skip to content

Commit 4ddde1d

Browse files
authored
Update docker-build-dockerhub.yml
1 parent 8d78c90 commit 4ddde1d

1 file changed

Lines changed: 12 additions & 53 deletions

File tree

Lines changed: 12 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
# act -W ../.github/workflows/docker-build-dockerhub.yml -s DOCKERHUB_USERNAME -s DOCKERHUB_TOKEN -s GITHUB_TOKEN="$(gh auth token)"
2-
---
3-
name: Build and Push Docker Image to DockerHub
1+
name: Build and Push Docker Image
42

53
on:
64
push:
75
tags:
86
- "*.*.*"
9-
workflow_dispatch:
10-
inputs:
11-
version:
12-
description: "Version to release (without v prefix)"
13-
required: true
14-
default: ""
157

168
jobs:
179
prepare:
@@ -22,59 +14,26 @@ jobs:
2214
- name: Set version from tag
2315
id: set-version
2416
run: |
25-
if [[ "${{ github.event_name }}" == "push" && \
26-
"${{ github.ref_type }}" == "tag" ]]; then
27-
VERSION="${GITHUB_REF#refs/tags/v}"
28-
else
29-
VERSION="${{ github.event.inputs.version }}"
30-
fi
17+
VERSION="${GITHUB_REF#refs/tags/}"
18+
VERSION="${VERSION#v}"
3119
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
3220
3321
build-and-push:
3422
needs: prepare
3523
runs-on: ubuntu-latest
24+
3625
steps:
37-
- name: Checkout
38-
uses: actions/checkout@v4
26+
- uses: actions/checkout@v4
3927

4028
- name: Set up Docker Buildx
41-
id: buildx
4229
uses: docker/setup-buildx-action@v3
43-
with:
44-
install: true
45-
version: latest
46-
driver-opts: image=moby/buildkit:latest
47-
48-
- name: Inspect builder
49-
run: |
50-
echo "Available platforms: $(docker buildx inspect --bootstrap | grep 'Platforms:')"
51-
docker buildx ls
52-
53-
- name: Set up QEMU
54-
uses: docker/setup-qemu-action@v3
55-
with:
56-
platforms: arm64,amd64
57-
image: tonistiigi/binfmt:latest
5830

59-
- name: Prepare Docker tags
60-
id: docker_meta
61-
uses: docker/metadata-action@v5
62-
with:
63-
images: crystaldba/postgres-mcp
64-
tags: |
65-
type=raw,value=${{ needs.prepare.outputs.version }}
66-
type=raw,value=latest
67-
68-
- name: Check directory structure
69-
run: |
70-
echo "check pwd: $(pwd)"
71-
echo "check ls: $(ls -lta)"
72-
73-
- name: Login to DockerHub
31+
- name: Login to Azure Container Registry
7432
uses: docker/login-action@v3
7533
with:
76-
username: ${{ secrets.DOCKERHUB_USERNAME }}
77-
password: ${{ secrets.DOCKERHUB_TOKEN }}
34+
registry: ${{ secrets.AZURE_CONTAINER_REGISTRY }}
35+
username: ${{ secrets.ST_DOCKER_USER }}
36+
password: ${{ secrets.ST_DOCKER_PASSWORD }}
7837

7938
- name: Build and push
8039
uses: docker/build-push-action@v5
@@ -83,6 +42,6 @@ jobs:
8342
file: Dockerfile
8443
platforms: linux/amd64,linux/arm64
8544
push: true
86-
tags: ${{ steps.docker_meta.outputs.tags }}
87-
cache-from: type=registry,ref=crystaldba/postgres-mcp:buildcache
88-
cache-to: type=registry,ref=crystaldba/postgres-mcp:buildcache,mode=max
45+
tags: |
46+
${{ secrets.AZURE_CONTAINER_REGISTRY }}/postgres-mcp:${{ needs.prepare.outputs.version }}
47+
${{ secrets.AZURE_CONTAINER_REGISTRY }}/postgres-mcp:latest

0 commit comments

Comments
 (0)