-
Notifications
You must be signed in to change notification settings - Fork 189
133 lines (127 loc) · 4.8 KB
/
docker-build-and-push.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
name: Docker Build and Push
on:
workflow_call:
inputs:
deploy_tag:
description: 'The deploy tag to use, one of `staging` or `production`'
required: true
type: string
web_url:
description: 'The front-end web URL (defaults to staging)'
required: false
default: 'https://dev.telescope.cdot.systems'
type: string
image_url:
description: 'The image microservice URL (defaults to staging)'
required: false
default: 'https://dev.api.telescope.cdot.systems/v1/image'
type: string
sso_url:
description: 'The sso microservice URL (defaults to staging)'
required: false
default: 'https://dev.api.telescope.cdot.systems/v1/auth'
type: string
posts_url:
description: 'The posts microservice URL (defaults to staging)'
required: false
default: 'https://dev.api.telescope.cdot.systems/v1/posts'
type: string
search_url:
description: 'The search microservice URL (defaults to staging)'
required: false
default: 'https://dev.api.telescope.cdot.systems/v1/search'
type: string
feed_discovery_url:
description: 'The feed-discovery microservice URL (defaults to staging)'
required: false
default: 'https://dev.api.telescope.cdot.systems/v1/feed-discovery'
type: string
status_url:
description: 'The status microservice URL (defaults to staging)'
required: false
default: 'https://dev.api.telescope.cdot.systems/v1/status'
type: string
dependency_discovery_url:
description: 'The feed-discovery microservice URL (defaults to staging)'
required: false
default: 'https://dev.api.telescope.cdot.systems/v1/dependency-discovery'
type: string
supabase_url:
description: 'The Supabase URL'
required: false
default: 'https://dev.api.telescope.cdot.systems/v1/supabase'
type: string
anon_key:
description: 'The Supabase Anonymous Key'
required: false
default: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UiLAogICAgImlhdCI6IDE2NDg2MTI4MDAsCiAgICAiZXhwIjogMTgwNjM3OTIwMAp9.mCKt384B1BIKP6DFUgC3bwcFGY8HdbWNUAsPTVQbQxo'
type: string
secrets:
docker_username:
description: 'The Docker Registry username'
required: true
docker_password:
description: 'The Docker Registry password'
required: true
jobs:
docker-build-push:
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: docker.cdot.systems
strategy:
matrix:
include:
# TODO
# - context: src/api
# image: telescope-base
- context: src/api/feed-discovery
image: feed-discovery
- context: src/web
image: nginx
build-args: |
WEB_URL=${{ inputs.web_url }}
IMAGE_URL=${{ inputs.image_url }}
SSO_URL=${{ inputs.sso_url }}
POSTS_URL=${{ inputs.posts_url }}
SEARCH_URL=${{ inputs.search_url }}
FEED_DISCOVERY_URL=${{ inputs.feed_discovery_url }}
STATUS_URL=${{ inputs.status_url }}
GIT_COMMIT=${{ github.sha }}
SUPABASE_URL=${{ inputs.supabase_url }}
ANON_KEY=${{ inputs.anon_key }}
DEPENDENCY_DISCOVERY_URL=${{ inputs.dependency_discovery_url }}
- context: src/api/posts
image: posts
- context: src/api/dependency-discovery
image: dependency-discovery
- context: src/api/status
image: status
- context: src/api/parser
image: parser
- context: src/api/image
image: image
- context: src/api/search
image: search
- context: src/api/sso
image: sso
- context: src/db
image: db-migrations
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
registry: https://${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
- uses: docker/build-push-action@v2
env:
DOCKER_REPO: ${{ env.DOCKER_REGISTRY }}/${{ matrix.image }}
with:
context: ${{ matrix.context }}
build-args: ${{ matrix.build-args }}
# Use our CDOT Docker Registry to cache image builds
cache-from: type=registry,ref=${{ env.DOCKER_REPO }}:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_REPO }}:buildcache,mode=max
tags: ${{ env.DOCKER_REPO }}:${{ inputs.deploy_tag }}, ${{ env.DOCKER_REPO }}:latest
push: true