Skip to content

Commit 6dadfa3

Browse files
committed
inital commit
1 parent 5963d2e commit 6dadfa3

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build and push server image
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
paths:
7+
- "Dockerfile"
8+
- "cmd/**"
9+
- "internal/**"
10+
- "pkg/**"
11+
- "go.mod"
12+
- "go.sum"
13+
- ".github/workflows/docker-publish.yml"
14+
workflow_dispatch: {}
15+
16+
env:
17+
REGISTRY: otelmap-server.registry.dockreg.com
18+
IMAGE_NAME: otelmap-server
19+
20+
jobs:
21+
docker:
22+
name: Build and push
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Set up QEMU
32+
uses: docker/setup-qemu-action@v3
33+
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
37+
- name: Log in to registry
38+
uses: docker/login-action@v3
39+
with:
40+
registry: ${{ env.REGISTRY }}
41+
username: ${{ env.REGISTRY_USERNAME }}
42+
password: ${{ secrets.REGISTRY_API_TOKEN }}
43+
44+
- name: Prepare tags
45+
id: meta
46+
shell: bash
47+
run: |
48+
sha_short="${GITHUB_SHA::7}"
49+
echo "sha_short=$sha_short" >> "$GITHUB_OUTPUT"
50+
51+
- name: Build and push
52+
uses: docker/build-push-action@v6
53+
with:
54+
context: .
55+
file: ./Dockerfile
56+
platforms: linux/amd64
57+
push: true
58+
tags: |
59+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
60+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.sha_short }}
61+
cache-from: type=gha
62+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)