-
Notifications
You must be signed in to change notification settings - Fork 4
/
Earthfile
58 lines (52 loc) · 2.22 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
VERSION 0.8
ARG --global ALL_BUILD_TARGETS="platform-library-m2-cache follower-app"
ARG --global DOCKER_IMAGE_PREFIX="cf-lob"
ARG --global DOCKER_IMAGES_EXTRA_TAGS=""
ARG --global DOCKER_REGISTRIES="hub.docker.com"
ARG --global HUB_DOCKER_COM_ORG=cardanofoundation
ARG --global PUSH=false
all:
LOCALLY
ARG RELEASE_TAG
FOR image_target IN $ALL_BUILD_TARGETS
BUILD +${image_target} --RELEASE_TAG=${RELEASE_TAG}
END
docker-publish:
ARG EARTHLY_GIT_SHORT_HASH
ARG RELEASE_TAG
WAIT
BUILD +all --RELEASE_TAG=${RELEASE_TAG}
END
LOCALLY
LET IMAGE_NAME = ""
FOR registry IN $DOCKER_REGISTRIES
FOR image_target IN $ALL_BUILD_TARGETS
SET IMAGE_NAME = ${DOCKER_IMAGE_PREFIX}-${image_target}
IF [ ! -z "$DOCKER_IMAGES_EXTRA_TAGS" ]
FOR image_tag IN $DOCKER_IMAGES_EXTRA_TAGS
IF [ "$registry" = "hub.docker.com" ]
RUN docker tag ${IMAGE_NAME}:latest ${HUB_DOCKER_COM_ORG}/${IMAGE_NAME}:${image_tag}
RUN if [ "$PUSH" = "true" ]; then docker push ${HUB_DOCKER_COM_ORG}/${IMAGE_NAME}:${image_tag}; fi
ELSE
RUN docker tag ${IMAGE_NAME}:latest ${registry}/${IMAGE_NAME}:${image_tag}
RUN if [ "$PUSH" = "true" ]; then docker push ${registry}/${IMAGE_NAME}:${image_tag}; fi
END
END
END
IF [ "$registry" = "hub.docker.com" ]
RUN docker tag ${IMAGE_NAME}:latest ${HUB_DOCKER_COM_ORG}/${IMAGE_NAME}:${EARTHLY_GIT_SHORT_HASH}
RUN if [ "$PUSH" = "true" ]; then docker push ${HUB_DOCKER_COM_ORG}/${IMAGE_NAME}:${EARTHLY_GIT_SHORT_HASH}; fi
ELSE
RUN docker tag ${IMAGE_NAME}:latest ${registry}/${IMAGE_NAME}:${EARTHLY_GIT_SHORT_HASH}
RUN if [ "$PUSH" = "true" ]; then docker push ${registry}/${IMAGE_NAME}:${EARTHLY_GIT_SHORT_HASH}; fi
END
END
END
platform-library-m2-cache:
ARG EARTHLY_TARGET_NAME
FROM DOCKERFILE -f Dockerfile --target ${EARTHLY_TARGET_NAME} .
SAVE IMAGE ${DOCKER_IMAGE_PREFIX}-${EARTHLY_TARGET_NAME}:latest
follower-app:
ARG EARTHLY_TARGET_NAME
FROM DOCKERFILE -f _backend-services/cf-lob-ledger-follower-app/Dockerfile --target ${EARTHLY_TARGET_NAME} ./_backend-services/cf-lob-ledger-follower-app
SAVE IMAGE ${DOCKER_IMAGE_PREFIX}-${EARTHLY_TARGET_NAME}:latest