-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (62 loc) · 2.25 KB
/
push_docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Publish Docker Image
on:
push:
tags:
- "[0-9]*"
jobs:
publish_docker_image:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Docker meta service name for GitHub development image
id: docker_meta_img_dev
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/dev
tags: |
type=raw,value=latest,enable=${{ github.event.repository.default_branch == 'main' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Docker meta service name for DockerHub production image
id: docker_meta_img_prod
uses: docker/metadata-action@v5
with:
images: schulcloud/erwin-idm
tags: |
type=raw,value=latest,enable=${{ github.event.repository.default_branch == 'main' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Log into GitHub registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log into DockerHub registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push ${{ github.repository }} development image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
target: development
tags: ${{ steps.docker_meta_img_dev.outputs.tags }}
labels: ${{ steps.docker_meta_img_dev.outputs.labels }}
- name: Build and push ${{ github.repository }} production image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
target: production
tags: ${{ steps.docker_meta_img_prod.outputs.tags }}
labels: ${{ steps.docker_meta_img_prod.outputs.labels }}