Skip to content

Commit 28c2bb4

Browse files
Enable Docker build and push workflow
1 parent 81f9e23 commit 28c2bb4

1 file changed

Lines changed: 56 additions & 56 deletions

File tree

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
# name: Build and Push Docker Image
2-
#
3-
# on:
4-
# push:
5-
# tags: ['v*']
6-
# pull_request:
7-
# branches: [main]
8-
#
9-
# env:
10-
# REGISTRY: ghcr.io
11-
# IMAGE_NAME: ${{ github.repository }}
12-
#
13-
# jobs:
14-
# build-and-push:
15-
# runs-on: ubuntu-latest
16-
# permissions:
17-
# contents: read
18-
# packages: write
19-
#
20-
# steps:
21-
# - name: Checkout repository
22-
# uses: actions/checkout@v6.0.2
23-
#
24-
# - name: Set up Docker Buildx
25-
# uses: docker/setup-buildx-action@v3.12.0
26-
#
27-
# - name: Log in to Container Registry
28-
# if: github.event_name != 'pull_request'
29-
# uses: docker/login-action@v3.6.0
30-
# with:
31-
# registry: ${{ env.REGISTRY }}
32-
# username: ${{ github.actor }}
33-
# password: ${{ secrets.GITHUB_TOKEN }}
34-
#
35-
# - name: Extract metadata (tags, labels)
36-
# id: meta
37-
# uses: docker/metadata-action@v5.10.0
38-
# with:
39-
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40-
# tags: |
41-
# type=ref,event=branch
42-
# type=ref,event=pr
43-
# type=semver,pattern={{version}}
44-
# type=semver,pattern={{major}}.{{minor}}
45-
# type=sha,prefix=
46-
#
47-
# - name: Build and push Docker image
48-
# uses: docker/build-push-action@v6.18.0
49-
# with:
50-
# context: .
51-
# push: ${{ github.event_name != 'pull_request' }}
52-
# tags: ${{ steps.meta.outputs.tags }}
53-
# labels: ${{ steps.meta.outputs.labels }}
54-
# cache-from: type=gha
55-
# cache-to: type=gha,mode=max
56-
# platforms: linux/amd64,linux/arm64
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Log in to Container Registry
28+
if: github.event_name != 'pull_request'
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels)
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
tags: |
41+
type=ref,event=branch
42+
type=ref,event=pr
43+
type=semver,pattern={{version}}
44+
type=semver,pattern={{major}}.{{minor}}
45+
type=sha,prefix=
46+
47+
- name: Build and push Docker image
48+
uses: docker/build-push-action@v6
49+
with:
50+
context: .
51+
push: ${{ github.event_name != 'pull_request' }}
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
56+
platforms: linux/amd64,linux/arm64

0 commit comments

Comments
 (0)