-
Notifications
You must be signed in to change notification settings - Fork 235
223 lines (214 loc) · 7.14 KB
/
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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Docker GHA
on:
push:
branches:
- main
- develop
tags:
- "v*.*.*"
pull_request:
merge_group:
workflow_dispatch:
inputs:
r_version:
description: 'R version to use'
required: true
type: choice
default: "4.1"
options:
- 4.1
- 4.2
- 4.3
- 4.4
- devel
jobs:
# ----------------------------------------------------------------------
# Set R version.
# This is a hack: We really just want a global env var here, but it seems
# `env:` values can't be passed into a `jobs.<jobid>.with` context
# (see https://github.com/actions/runner/issues/2372).
# As an ugly workaround, we assign it to a job output instead.
# ----------------------------------------------------------------------
rversion:
runs-on: ubuntu-latest
steps:
- run: echo "null"
outputs:
R_VERSION: ${{ github.event.inputs.r_version || '4.1' }}
# ----------------------------------------------------------------------
# depends image has all the dependencies installed
# ----------------------------------------------------------------------
depends:
needs: rversion
uses: ./.github/workflows/docker-build-image.yml
with:
image-name: depends
build-context: docker/depends
dockerfile: docker/depends/Dockerfile
r-version: ${{ needs.rversion.outputs.R_VERSION }}
platforms: "linux/amd64"
secrets: inherit
# ----------------------------------------------------------------------
# base image has PEcAn compiled and installed, and depends on depends
# ----------------------------------------------------------------------
base:
needs: [rversion, depends]
uses: ./.github/workflows/docker-build-image.yml
with:
image-name: base
build-context: .
dockerfile: docker/base/Dockerfile
r-version: ${{ needs.rversion.outputs.R_VERSION }}
from-image: depends
platforms: "linux/amd64"
secrets: inherit
# ----------------------------------------------------------------------
# models image has some python installed to run models, depends on base
# ----------------------------------------------------------------------
models:
needs: [rversion, base]
uses: ./.github/workflows/docker-build-image.yml
with:
image-name: models
build-context: docker/models
dockerfile: docker/models/Dockerfile
r-version: ${{ needs.rversion.outputs.R_VERSION }}
from-image: depends # TODO is this correct? Dockerfile hardcodes FROM pecan/base
secrets: inherit
# ----------------------------------------------------------------------
# Next are images that have models installed
# ----------------------------------------------------------------------
modelsbinary:
needs: [rversion, models]
strategy:
fail-fast: false
matrix:
name:
- basgra
- biocro
# - ed2_2.2.0
- ed2_git
- maespa
- sipnet
include:
- name: basgra
CONTEXT: models/basgra
DOCKERFILE: models/basgra/Dockerfile
PLATFORM: "linux/amd64"
MODEL: basgra
VERSION: BASGRA_N_v1
- name: biocro
CONTEXT: models/biocro
DOCKERFILE: models/biocro/Dockerfile
PLATFORM: "linux/amd64"
MODEL: biocro
VERSION: "0.95"
# - name: ed2_2.2.0
# CONTEXT: models/ed
# DOCKERFILE: models/ed/Dockerfile
# PLATFORM: "linux/amd64"
# MODEL: ed2
# VERSION: "2.2.0"
- name: ed2_git
CONTEXT: models/ed
DOCKERFILE: models/ed/Dockerfile
PLATFORM: "linux/amd64"
MODEL: ed2
VERSION: "git"
- name: maespa
CONTEXT: models/maespa
DOCKERFILE: models/maespa/Dockerfile
PLATFORM: "linux/amd64"
MODEL: maespa
VERSION: "git"
- name: sipnet
CONTEXT: models/sipnet
DOCKERFILE: models/sipnet/Dockerfile
PLATFORM: "linux/amd64"
MODEL: sipnet
VERSION: "git"
uses: ./.github/workflows/docker-build-image.yml
with:
image-name: model-${{ matrix.MODEL }}-${{ matrix.VERSION }}
build-context: ${{ matrix.CONTEXT }}
dockerfile: ${{ matrix.DOCKERFILE }}
r-version: ${{ needs.rversion.outputs.R_VERSION }}
# no `from-image:` needed here -- it's hardcoded as `FROM pecan/models` in the Dockerfiles
model-version: ${{ matrix.VERSION }}
platforms: ${{ matrix.PLATFORM }}
secrets: inherit
# ----------------------------------------------------------------------
# Next are images that depend on base image
# ----------------------------------------------------------------------
baseplus:
needs: [rversion, base]
strategy:
fail-fast: false
matrix:
name:
- docs
- executor
- api
include:
- name: docs
CONTEXT: .
DOCKERFILE: docker/docs/Dockerfile
PLATFORM: "linux/amd64"
- name: executor
CONTEXT: docker/executor
DOCKERFILE: docker/executor/Dockerfile
PLATFORM: "linux/amd64"
- name: api
CONTEXT: apps/api
DOCKERFILE: apps/api/Dockerfile
PLATFORM: "linux/amd64"
uses: ./.github/workflows/docker-build-image.yml
with:
image-name: ${{ matrix.name }}
build-context: ${{ matrix.CONTEXT }}
dockerfile: ${{ matrix.DOCKERFILE }}
r-version: ${{ needs.rversion.outputs.R_VERSION }}
platforms: ${{ matrix.PLATFORM }}
secrets: inherit
# ----------------------------------------------------------------------
# Next are images that do not depend on either depends or base image
# ----------------------------------------------------------------------
extras:
needs: rversion
strategy:
fail-fast: false
matrix:
name:
- web
- shiny-dbsync
- data
- monitor
- rstudio-nginx
include:
- name: web
CONTEXT: .
DOCKERFILE: docker/web/Dockerfile
PLATFORM: "linux/amd64,linux/arm64"
- name: shiny-dbsync
CONTEXT: .
DOCKERFILE: shiny/dbsync/Dockerfile
PLATFORM: "linux/amd64"
- name: data
CONTEXT: docker/data
DOCKERFILE: docker/data/Dockerfile
PLATFORM: "linux/amd64,linux/arm64"
- name: monitor
CONTEXT: docker/monitor
DOCKERFILE: docker/monitor/Dockerfile
PLATFORM: "linux/amd64,linux/arm64"
- name: rstudio-nginx
CONTEXT: docker/rstudio-nginx
DOCKERFILE: docker/rstudio-nginx/Dockerfile
PLATFORM: "linux/amd64,linux/arm64"
uses: ./.github/workflows/docker-build-image.yml
with:
image-name: ${{ matrix.name }}
build-context: ${{ matrix.CONTEXT }}
dockerfile: ${{ matrix.DOCKERFILE }}
platforms: ${{ matrix.PLATFORM }}
r-version: ${{ needs.rversion.outputs.R_VERSION }}