-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEarthfile
160 lines (137 loc) · 4.49 KB
/
Earthfile
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
VERSION 0.8
IMPORT --allow-privileged github.com/cardano-foundation/cf-gha-workflows/./earthfiles/functions:main AS functions
ARG --global DOCKER_IMAGES_TARGETS="voting-app vote-commitment-app voting-ledger-follower-app voting-verification-app user-verification-service voting-admin-app keri-ballot-verifier ui-summit-2024"
ARG --global DOCKER_IMAGES_PREFIX="cf"
ARG --global DOCKER_IMAGES_EXTRA_TAGS=""
ARG --global DOCKER_REGISTRIES=""
ARG --global RELEASE_TAG=""
ARG --global PUSH=false
all:
LOCALLY
FOR image_target IN $DOCKER_IMAGES_TARGETS
BUILD +$image_target --PUSH=$PUSH
END
docker-publish:
BUILD +all --PUSH=$PUSH
TEMPLATED_RELEASE_PREPARATION:
FUNCTION
ARG TARGET_NAME
ARG DOCKER_IMAGE_NAME
ARG RELEASE_TAG
FROM ${DOCKER_IMAGE_NAME}
RUN mv /app/*jar /app/${TARGET_NAME}_${RELEASE_TAG}.jar
RUN md5sum /app/*jar > /app/${TARGET_NAME}-${RELEASE_TAG}.jar.md5sum
SAVE ARTIFACT /app/* AS LOCAL release/
voting-app:
ARG EARTHLY_TARGET_NAME
LET DOCKER_IMAGE_NAME=${DOCKER_IMAGES_PREFIX}-${EARTHLY_TARGET_NAME}
WAIT
FROM DOCKERFILE ./backend-services/${EARTHLY_TARGET_NAME}
END
WAIT
SAVE IMAGE ${DOCKER_IMAGE_NAME}
END
DO functions+DOCKER_TAG_N_PUSH \
--PUSH=$PUSH \
--DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} \
--DOCKER_IMAGES_EXTRA_TAGS="${DOCKER_IMAGES_EXTRA_TAGS}"
# FIXME: not working as there is some scoping issue with earthly, see:
# https://github.com/earthly/earthly/issues/4045
#IF [ ! -z "${RELEASE_TAG}" ]
# DO +TEMPLATED_RELEASE_PREPARATION \
# --TARGET_NAME=${EARTHLY_TARGET_NAME} \
# --DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} \
# --RELEASE_TAG=${RELEASE_TAG}
#END
vote-commitment-app:
ARG EARTHLY_TARGET_NAME
LET DOCKER_IMAGE_NAME=${DOCKER_IMAGES_PREFIX}-${EARTHLY_TARGET_NAME}
WAIT
FROM DOCKERFILE ./backend-services/${EARTHLY_TARGET_NAME}
END
WAIT
SAVE IMAGE ${DOCKER_IMAGE_NAME}
END
DO functions+DOCKER_TAG_N_PUSH \
--PUSH=$PUSH \
--DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} \
--DOCKER_IMAGES_EXTRA_TAGS="${DOCKER_IMAGES_EXTRA_TAGS}"
voting-ledger-follower-app:
ARG EARTHLY_TARGET_NAME
LET DOCKER_IMAGE_NAME=${DOCKER_IMAGES_PREFIX}-${EARTHLY_TARGET_NAME}
WAIT
FROM DOCKERFILE ./backend-services/${EARTHLY_TARGET_NAME}
END
WAIT
SAVE IMAGE ${DOCKER_IMAGE_NAME}
END
DO functions+DOCKER_TAG_N_PUSH \
--PUSH=$PUSH \
--DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} \
--DOCKER_IMAGES_EXTRA_TAGS="${DOCKER_IMAGES_EXTRA_TAGS}"
voting-verification-app:
ARG EARTHLY_TARGET_NAME
LET DOCKER_IMAGE_NAME=${DOCKER_IMAGES_PREFIX}-${EARTHLY_TARGET_NAME}
WAIT
FROM DOCKERFILE ./backend-services/${EARTHLY_TARGET_NAME}
END
WAIT
SAVE IMAGE ${DOCKER_IMAGE_NAME}
END
DO functions+DOCKER_TAG_N_PUSH \
--PUSH=$PUSH \
--DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} \
--DOCKER_IMAGES_EXTRA_TAGS="${DOCKER_IMAGES_EXTRA_TAGS}"
user-verification-service:
ARG EARTHLY_TARGET_NAME
LET DOCKER_IMAGE_NAME=${DOCKER_IMAGES_PREFIX}-${EARTHLY_TARGET_NAME}
WAIT
FROM DOCKERFILE ./backend-services/${EARTHLY_TARGET_NAME}
END
WAIT
SAVE IMAGE ${DOCKER_IMAGE_NAME}
END
DO functions+DOCKER_TAG_N_PUSH \
--PUSH=$PUSH \
--DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} \
--DOCKER_IMAGES_EXTRA_TAGS="${DOCKER_IMAGES_EXTRA_TAGS}"
ui-summit-2024:
ARG EARTHLY_TARGET_NAME
ARG VITE_VERSION=0.1.0
LET DOCKER_IMAGE_NAME=${DOCKER_IMAGES_PREFIX}-${EARTHLY_TARGET_NAME}
WAIT
FROM DOCKERFILE --build-arg VITE_VERSION=${VITE_VERSION} ./ui/summit-2024
END
WAIT
SAVE IMAGE ${DOCKER_IMAGE_NAME}
END
DO functions+DOCKER_TAG_N_PUSH \
--PUSH=$PUSH \
--DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} \
--DOCKER_IMAGES_EXTRA_TAGS="${DOCKER_IMAGES_EXTRA_TAGS}"
voting-admin-app:
ARG EARTHLY_TARGET_NAME
LET DOCKER_IMAGE_NAME=${DOCKER_IMAGES_PREFIX}-${EARTHLY_TARGET_NAME}
WAIT
FROM DOCKERFILE ./backend-services/${EARTHLY_TARGET_NAME}
END
WAIT
SAVE IMAGE ${DOCKER_IMAGE_NAME}
END
DO functions+DOCKER_TAG_N_PUSH \
--PUSH=$PUSH \
--DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} \
--DOCKER_IMAGES_EXTRA_TAGS="${DOCKER_IMAGES_EXTRA_TAGS}"
keri-ballot-verifier:
ARG EARTHLY_TARGET_NAME
LET DOCKER_IMAGE_NAME=${DOCKER_IMAGES_PREFIX}-${EARTHLY_TARGET_NAME}
WAIT
FROM DOCKERFILE ./backend-services/${EARTHLY_TARGET_NAME}
END
WAIT
SAVE IMAGE ${DOCKER_IMAGE_NAME}
END
DO functions+DOCKER_TAG_N_PUSH \
--PUSH=$PUSH \
--DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} \
--DOCKER_IMAGES_EXTRA_TAGS="${DOCKER_IMAGES_EXTRA_TAGS}"