Skip to content

Commit 4a1d236

Browse files
add github actions
1 parent a355cd0 commit 4a1d236

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/docker.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Docker Image
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths:
7+
- "service/**"
8+
- "docker-compose.yml"
9+
- ".github/workflows/docker.yml"
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to GHCR
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata (tags, labels)
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ghcr.io/${{ github.repository_owner }}/standard_python_environment
38+
tags: |
39+
type=raw,value=latest
40+
type=ref,event=branch
41+
type=sha
42+
43+
- name: Build and push
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: ./service
47+
file: ./service/Dockerfile
48+
platforms: linux/amd64
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)