Skip to content

Commit b3b09a9

Browse files
authored
Create docker-publish.yml
1 parent 39f793f commit b3b09a9

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/docker-publish.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build Docker Image, Push to GHCR
2+
3+
on:
4+
push:
5+
branches: [ "main", "ohm"]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: openhistoricalmap/osmcha-frontend
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
# Enable BuildKit for docker builds. This enables building
20+
# multi-platform images and exporting the layer cache
21+
# https://github.com/docker/setup-buildx-action
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
# https://github.com/docker/login-action
26+
- name: Login to Registry ${{ env.REGISTRY }}
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
# Extract metadata (tags, labels) for Docker
34+
# https://github.com/docker/metadata-action
35+
- name: Extract Docker metadata
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
41+
# https://github.com/docker/build-push-action
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: .
46+
push: true
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)