-
Notifications
You must be signed in to change notification settings - Fork 21
140 lines (140 loc) · 4.95 KB
/
publish_docker_images.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
name: Publish Docker images
on:
push:
branches:
- master
- dev
env:
IMG_AUTH: idsrv4-auth
IMG_BACKEND: idsrv4-backend
IMG_NGINX: idsrv4-nginx
IMG_OPENLDAP: openldap
IMG_TAG_DEFAULT: latest
jobs:
push_images_to_dockerhub:
name: Push images to Docker Hub
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push auth
id: build_publish_auth
uses: docker/build-push-action@v2
with:
# context: .
file: ./docker/auth.dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMG_AUTH }}:${{ env.IMG_TAG_DEFAULT }}
# - name: Image digest
# run: echo ${{ steps.build_publish_auth.outputs.digest }}
- name: Build and push backend
id: build_publish_backend
uses: docker/build-push-action@v2
with:
# context: .
file: ./docker/backend.dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMG_BACKEND }}:${{ env.IMG_TAG_DEFAULT }}
- name: Build and push nginx
id: build_publish_nginx
uses: docker/build-push-action@v2
with:
context: ./docker
file: ./docker/nginx.dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMG_NGINX }}:${{ env.IMG_TAG_DEFAULT }}
push_images_to_acr:
name: Push images to ACR
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Login to ACR
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_REGISTRY }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build and push Auth
id: build_publish_auth
uses: docker/build-push-action@v2
with:
# context: .
file: ./docker/auth.dockerfile
push: true
tags: ${{ secrets.ACR_REGISTRY }}/${{ env.IMG_AUTH }}:${{ env.IMG_TAG_DEFAULT }}
- name: Build and push backend
id: build_publish_backend
uses: docker/build-push-action@v2
with:
# context: .
file: ./docker/backend.dockerfile
push: true
tags: ${{ secrets.ACR_REGISTRY }}/${{ env.IMG_BACKEND }}:${{ env.IMG_TAG_DEFAULT }}
- name: Build and push nginx
id: build_publish_nginx
uses: docker/build-push-action@v2
with:
context: ./docker
file: ./docker/nginx.dockerfile
push: true
tags: ${{ secrets.ACR_REGISTRY }}/${{ env.IMG_NGINX }}:${{ env.IMG_TAG_DEFAULT }}
- name: Pull and push openldap
id: publish_openldap
run: |
docker pull osixia/openldap:stable
docker tag osixia/openldap:stable ${{ secrets.ACR_REGISTRY }}/${{ env.IMG_OPENLDAP }}:stable
docker push ${{ secrets.ACR_REGISTRY}}/${{ env.IMG_OPENLDAP }}:stable
push_images_to_ghcr:
name: Push images to GitHub Container Registry
# env:
# REPO: karatejb/aspnetcore.identityserver4.sample # The value should be lowercase for image name. Or just use ${{ github.repository }}.
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: Set environment variables
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Build and push auth
id: build_publish_auth
uses: docker/build-push-action@v2
with:
# context: .
file: ./docker/auth.dockerfile
push: true
tags: ghcr.io/${{ env.REPO }}/${{ env.IMG_AUTH }}:${{ env.IMG_TAG_DEFAULT }}
- name: Build and push backend
id: build_publish_backend
uses: docker/build-push-action@v2
with:
# context: .
file: ./docker/backend.dockerfile
push: true
tags: ghcr.io/${{ env.REPO }}/${{ env.IMG_BACKEND }}:${{ env.IMG_TAG_DEFAULT }}
- name: Build and push nginx
id: build_publish_nginx
uses: docker/build-push-action@v2
with:
context: ./docker
file: ./docker/nginx.dockerfile
push: true
tags: ghcr.io/${{ env.REPO }}/${{ env.IMG_NGINX }}:${{ env.IMG_TAG_DEFAULT }}
- name: Pull and push openldap
id: publish_openldap
run: |
docker pull osixia/openldap:stable
docker tag osixia/openldap:stable ghcr.io/${{ env.REPO }}/${{ env.IMG_OPENLDAP }}:stable
docker push ghcr.io/${{ env.REPO }}/${{ env.IMG_OPENLDAP }}:stable