Skip to content

Commit e7d5ed2

Browse files
author
lijianguo
committed
chore(imagebuilder): modify build
1 parent bdd60e3 commit e7d5ed2

3 files changed

Lines changed: 22 additions & 14 deletions

File tree

charts/imagebuilder/templates/imagebuilder-configmap.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ data:
88
images.json: |
99
[
1010
{
11-
"name": "imagebuilder",
11+
"name": "container",
12+
"image": "{{.Values.image_registry}}/{{.Values.org}}/imagebuilder:{{.Values.image_tag}}"
13+
},
14+
{
15+
"name": "buildpack",
1216
"image": "{{.Values.image_registry}}/{{.Values.org}}/imagebuilder:{{.Values.image_tag}}"
1317
}
1418
]

rootfs/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ COPY --from=mc /usr/bin/mc /bin/mc
88
RUN /imagebuilder/install
99

1010
WORKDIR /app
11-
ENV HOME /app
11+
ENV HOME /tmp
12+
ENV XDG_DATA_HOME /tmp
13+
ENV XDG_CONFIG_HOME /tmp/.config
1214

1315
ENTRYPOINT ["/imagebuilder/build"]

rootfs/imagebuilder/build

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function waiting_process {
2929
}
3030

3131
# Start podman service
32-
export DOCKER_HOST="unix:///var/run/podman.sock"
32+
export DOCKER_HOST=tcp://127.0.0.1:1234
3333

3434
log_level="error"
3535
if [[ "${DRYCC_DEBUG}" ]]; then
@@ -39,13 +39,12 @@ fi
3939

4040
podman system service \
4141
--log-level "${log_level}" \
42-
--time 0 "${DOCKER_HOST}" &
42+
--time 0 tcp:0.0.0.0:1234 &
4343

4444
waiting_process podman
45-
4645
if [[ -n "${TAR_PATH}" ]]; then
4746
get_object
48-
tar -xzf /tmp/app.tgz -C /app/
47+
tar -xzf /tmp/app.tgz -C /app/ && \
4948
unset TAR_PATH
5049
fi
5150

@@ -60,19 +59,22 @@ if [[ "${DRYCC_REGISTRY_LOCATION}" == "off-cluster" ]] ; then
6059
podman login \
6160
--username "${DRYCC_REGISTRY_USERNAME}" \
6261
--password "${DRYCC_REGISTRY_PASSWORD}" \
63-
"${DRYCC_REGISTRY_HOSTNAME}" --tls-verify=false
62+
"${DRYCC_REGISTRY_HOSTNAME}" --tls-verify=false \
63+
> /dev/null
6464
else
6565
# Start registry proxy
6666
registry="${DRYCC_REGISTRY_PROXY_HOST}:${DRYCC_REGISTRY_PROXY_PORT}"
6767
caddy reverse-proxy \
6868
--from ":${DRYCC_REGISTRY_PROXY_PORT}" \
69-
--to "${DRYCC_REGISTRY_SERVICE_HOST}:${DRYCC_REGISTRY_SERVICE_PORT}" &
69+
--to "${DRYCC_REGISTRY_SERVICE_HOST}:${DRYCC_REGISTRY_SERVICE_PORT}" \
70+
>"$([ "${log_level}" == "debug" ] && echo "/dev/stdout" || echo "/dev/null")" 2>&1 &
7071
waiting_process caddy
7172
podman login \
7273
--username drycc \
7374
--password drycc \
7475
--tls-verify=false \
75-
"${registry}"
76+
"${registry}" \
77+
> /dev/null
7678
fi
7779

7880
# Get image name and image tag
@@ -83,19 +85,19 @@ image_cache_repo="${registry}/${image_name}:latest"
8385

8486
# Pull latest image as cache
8587
{
86-
echo "---> Reusing cache"
88+
echo "---> Reusing cache"
8789
podman pull "${image_cache_repo}" --tls-verify=false >/dev/null 2>&1
8890
} || {
89-
echo "---> Cache not found"
91+
echo "---> Cache not found"
9092
}
91-
9293
# Building
9394
if [[ "${DRYCC_STACK}" == "container" ]] ; then
9495
echo "---> Building container"
95-
podman build -t "${image_cache_repo}" .
96+
podman build -t "${image_cache_repo}" --network host .
9697
else
9798
echo "---> Building pack"
98-
pack build "${image_cache_repo}" --builder "${pack_builder}" --docker-host "${DOCKER_HOST}"
99+
echo "use builder ${pack_builder}"
100+
pack build "${image_cache_repo}" --builder "${pack_builder}" --docker-host "${DOCKER_HOST}" --lifecycle-image docker.io/drycc/lifecycle:0.11.3 --trust-builder --network host
99101
fi
100102

101103
# Publish image

0 commit comments

Comments
 (0)