File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -12,23 +12,25 @@ variables:
12
12
- docker:$DOCKER_VERSION-dind
13
13
variables :
14
14
DOCKER_BUILDKIT : 1
15
- DOCKER_PLATFORM : " linux/amd64"
16
- # TODO: Make target optional
17
- DOCKER_TARGET : dev
15
+ DOCKER_PLATFORM : " "
16
+ DOCKER_TARGET : " "
18
17
before_script :
19
18
- apk add --no-cache bash git
20
19
script :
21
20
- docker buildx create --use
22
21
- docker buildx inspect --bootstrap
23
22
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
24
23
- echo "Building $DOCKER_IMAGE_FULL_TAG - Cache from $DOCKER_IMAGE_NAME:cache"
24
+ - if [[ -n "$DOCKER_TARGET" ]]; then export TARGET_ARG="--target $DOCKER_TARGET"; fi;
25
+ - if [[ -n "$DOCKER_PLATFORM" ]]; then export PLATFORM_ARG="--platform $DOCKER_PLATFORM"; fi;
26
+ - if [[ -n "$DOCKER_PLATFORM" ]]; then export PLATFORM_SUFFIX="-$(echo $DOCKER_PLATFORM | sed 's/\///')"; fi;
25
27
# remove \ from platform to
26
28
- export SUFFIX=$(echo $DOCKER_PLATFORM | sed 's/\///')
27
29
- |
28
30
docker buildx build --push \
29
- --target $DOCKER_TARGET \
30
- --tag $DOCKER_IMAGE_FULL_TAG-$SUFFIX \
31
- --platform $DOCKER_PLATFORM \
31
+ $TARGET_ARG \
32
+ --tag $DOCKER_IMAGE_FULL_TAG$PLATFORM_SUFFIX \
33
+ $PLATFORM_ARG \
32
34
--cache-from type=registry,ref=$DOCKER_IMAGE_NAME:cache \
33
35
--cache-to type=registry,ref=$DOCKER_IMAGE_NAME:cache \
34
36
.
You can’t perform that action at this time.
0 commit comments