Skip to content

Commit 51e08c8

Browse files
committed
[+] updated Dockerfile to remove CGO_ENABLED flag for building the main application
[*] updated GitHub Actions workflow to trigger on 'development' branch instead of 'test' [*] added metadata extraction and Docker Buildx setup for building and pushing Docker images [-] removed obsolete development.yaml workflow file
1 parent de6927c commit 51e08c8

File tree

3 files changed

+28
-66
lines changed

3 files changed

+28
-66
lines changed

.github/workflows/deploy.yaml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
- test
7+
- development
88
tags:
99
- "v*"
1010
release:
@@ -66,9 +66,9 @@ jobs:
6666
labels: ${{ steps.meta.outputs.labels }}
6767
platforms: linux/amd64,linux/arm64,linux/386
6868

69-
build-and-push-test:
69+
build-and-push-development:
7070
runs-on: ubuntu-latest
71-
if: github.ref == 'refs/heads/test'
71+
if: github.ref == 'refs/heads/development'
7272
permissions:
7373
contents: read
7474
packages: write
@@ -92,10 +92,30 @@ jobs:
9292
username: hasirciogli
9393
password: ${{ secrets.GITHUB_TOKEN }}
9494

95-
- name: Build test image
96-
run: |
97-
docker build -t ghcr.io/hasirciogli/xdatabase-proxy:latest-test .
98-
docker push ghcr.io/hasirciogli/xdatabase-proxy:latest-test
95+
- name: Extract metadata for Docker
96+
id: meta
97+
uses: docker/metadata-action@v5
98+
with:
99+
images: ghcr.io/hasirciogli/xdatabase-proxy-development
100+
tags: |
101+
type=ref,event=branch
102+
type=ref,event=pr
103+
type=semver,pattern={{version}}
104+
type=semver,pattern={{major}}.{{minor}}
105+
106+
- name: Set up Docker Buildx
107+
uses: docker/setup-buildx-action@v3
108+
with:
109+
driver: docker-container
110+
111+
- name: Build and push Docker image
112+
uses: docker/build-push-action@v5
113+
with:
114+
context: .
115+
push: true
116+
tags: ${{ steps.meta.outputs.tags }}
117+
labels: ${{ steps.meta.outputs.labels }}
118+
platforms: linux/amd64,linux/arm64,linux/386
99119

100120
create-release:
101121
needs: build-and-push

.github/workflows/development.yaml

Lines changed: 0 additions & 58 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /app
44

55
COPY . .
66

7-
RUN CGO_ENABLED=0 go build -o main apps/proxy/main.go
7+
RUN go build -o main apps/proxy/main.go
88

99
FROM alpine:latest as runner
1010

0 commit comments

Comments
 (0)