Skip to content

Commit cda88c2

Browse files
committed
chore(imagebuilder): add imagebuilder config
1 parent e088abd commit cda88c2

3 files changed

Lines changed: 29 additions & 12 deletions

File tree

charts/imagebuilder/templates/imagebuilder-configmap.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ metadata:
66
heritage: drycc
77
data:
88
buildpacks: "{{.Values.imageRegistry}}/{{.Values.imageOrg}}/buildpacks:bullseye"
9+
auths.json: |
10+
{
11+
"auths": {
12+
"registry.drycc.cc": {
13+
"auth": "YW5vbnltb3VzOmFub255bW91cw=="
14+
}
15+
}
16+
}
917
images.json: |
1018
[
1119
{

rootfs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENV DRYCC_UID=1001 \
66
PODMAN_VERSION="4.0.3" \
77
MC_VERSION="2022.04.01.23.44.48" \
88
CADDY_VERSION="2.4.6" \
9-
PACK_VERSION="0.24.1" \
9+
PACK_VERSION="0.25.0" \
1010
GOSU_VERSION="1.14"
1111

1212
RUN groupadd drycc --gid ${DRYCC_GID} \

rootfs/imagebuilder/build

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@ if [[ "${DRYCC_DEBUG}" ]]; then
3535
unset DRYCC_DEBUG
3636
fi
3737

38-
mkdir -p "${HOME}"/.config/containers
39-
cp -rf /opt/drycc/podman/etc/containers/* "${HOME}"/.config/containers
40-
registries="/etc/imagebuilder/registries.conf"
41-
if [ -f "${registries}" ]; then
42-
cat "${registries}" > "${HOME}"/.config/containers/registries.conf
38+
CONTAINERS_CONFIG_DIR="${HOME}"/.config/containers
39+
mkdir -p "${CONTAINERS_CONFIG_DIR}"
40+
from_registries_file="/etc/imagebuilder/registries.conf"
41+
cp -rf /opt/drycc/podman/etc/containers/* "${CONTAINERS_CONFIG_DIR}"
42+
if [ -f "${from_registries_file}" ]; then
43+
install -D "${from_registries_file}" "${CONTAINERS_CONFIG_DIR}"/registries.conf
4344
fi
4445

46+
readonly REGISTRY_AUTH_FILE="${HOME}"/.docker/config.json
47+
from_auths_file="/etc/imagebuilder/auths.json"
48+
if [ -f "${from_auths_file}" ]; then
49+
install -D "${from_auths_file}" "${REGISTRY_AUTH_FILE}"
50+
fi
51+
export REGISTRY_AUTH_FILE
52+
4553
podman system service --time 0 &
4654

4755
waiting_process podman
@@ -82,7 +90,8 @@ else
8290
fi
8391

8492
# Get image name and image tag
85-
image_base_name=$(echo "${IMAGE_NAME}" | awk -F ':' '{print $1}')
93+
image_tag=$(echo "${IMAGE_NAME}" | awk -F ':' '{print $NF}')
94+
image_base_name=$(echo "${IMAGE_NAME}" | sed -s "s#:${image_tag}##g")
8695
image_cache_name="${image_base_name}":cache
8796
image_latest_name="${image_base_name}":latest
8897

@@ -102,20 +111,20 @@ else
102111
# podman connection
103112
readonly DOCKER_HOST="unix://$(podman info -f "{{.Host.RemoteSocket.Path}}")"
104113
export DOCKER_HOST
105-
pack_command="pack build ${IMAGE_NAME} \
114+
115+
pack_build="pack build ${IMAGE_NAME} \
106116
--builder ${pack_builder} \
107117
--docker-host ${DOCKER_HOST} \
108118
--previous-image ${image_latest_name} \
109-
--trust-builder \
110119
--publish \
111120
--cache-image ${image_cache_name} \
112121
--tag ${image_latest_name} \
113122
--network host"
114123
if [[ $log_level == "debug" ]] ; then
115-
pack_command="$pack_command --verbose"
124+
pack_build="$pack_build --verbose"
116125
fi
117126
if [[ -f .clear-cache ]]; then
118-
pack_command="$pack_command --clear-cache"
127+
pack_build="$pack_build --clear-cache"
119128
fi
120-
$pack_command
129+
$pack_build
121130
fi

0 commit comments

Comments
 (0)