-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd.sh
executable file
·23 lines (18 loc) · 808 Bytes
/
cmd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
set -e
# auth
export auth=$(echo -n "${username}:${password}" | base64)
envsubst < /root/.docker/config.template.json > /root/.docker/config.json
# busybox cp doesn't have --no-clobber; use mv instead to ensure valid cacheDir exists
cp -R /default_cache/. /default_cache_cp
mv --no-clobber /default_cache_cp/* /cacheDir
# until buildkit uses latest tag by default; need to provide explicit cache tag
digest=$(cat /cacheDir/index.json | jp -u "manifests[?annotations.\"org.opencontainers.image.ref.name\"=='latest'].digest | [0]")
buildctl-daemonless.sh \
build \
--frontend dockerfile.v0 \
--local context=/buildContext \
--local dockerfile=/ \
--output type=oci,dest=/imageTar \
--import-cache "type=local,src=/cacheDir,digest=$digest" \
--export-cache type=local,dest=/cacheDir