Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ RUN CGO_ENABLED=0 go build -o /usr/local/bin/dind-cleaner ./cmd \
FROM golang:1.26-alpine3.23 AS bbolt
RUN go install go.etcd.io/bbolt/cmd/bbolt@latest

FROM quay.io/containers/skopeo:v1.22.2 AS preloaded-images
COPY images-list.txt /images-list.txt
COPY load-images.sh /load-images.sh
RUN chmod +x /load-images.sh && /load-images.sh /images-list.txt /images

# Main
FROM docker:${DOCKER_VERSION}-dind AS prod
Expand All @@ -30,11 +34,14 @@ RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.23/main' >> /etc/apk/repositor
# Backward compatibility with kernels that do not support `iptables-nft`. Check #CR-23033 for details.
RUN update-alternatives --install $(which iptables) iptables $(which iptables-legacy) 10 \
&& update-alternatives --install $(which ip6tables) ip6tables $(which ip6tables-legacy) 10
# DHI source: https://hub.docker.com/repository/docker/octopusdeploy/dhi-node-exporter
# DHI source: https://hub.docker.com/repository/docker/octopusdeploy/dhi-node-exporter
COPY --from=docker.io/octopusdeploy/dhi-node-exporter:1.11.1-alpine3.23@sha256:8cd8b3f56f6c319a03c7a2224e99d07e34241ae9ced308df5a6fee41d61ea905 /usr/bin/node_exporter /bin/
COPY --from=bbolt /go/bin/bbolt /bin/
COPY --from=cleaner /usr/local/bin/dind-cleaner /bin/

# Bake in preloaded image tarballs
COPY --from=preloaded-images /images /preloaded-images

WORKDIR /dind
ADD . /dind

Expand Down
10 changes: 10 additions & 0 deletions images-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
docker.io/tonistiigi/binfmt:qemu-v10.2.1
quay.io/codefresh/cf-container-logger:2.0.12
quay.io/codefresh/cf-debugger:1.3.14
quay.io/codefresh/cf-docker-builder:1.6.1
quay.io/codefresh/cf-docker-puller:8.0.27
quay.io/codefresh/cf-docker-pusher:6.0.26
quay.io/codefresh/cf-git-cloner:10.3.11
quay.io/codefresh/compose:v5.1.3-1.6.4
quay.io/codefresh/fs-ops:1.2.13
quay.io/codefresh/pikolo:0.15.1
43 changes: 43 additions & 0 deletions load-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
# Preload OCI images into docker-archive tarballs using skopeo.
#
# Usage:
# preload-images.sh <image-list-file> <output-dir>
#
# image-list-file: one image reference per line; blank lines and # comments ignored.
# output-dir: directory where .tar files are written (created if missing).

set -x

LIST_FILE="${1:?usage: $0 <image-list-file> <output-dir>}"
OUT_DIR="${2:?usage: $0 <image-list-file> <output-dir>}"

if [ ! -f "$LIST_FILE" ]; then
echo "ERROR: image list not found: $LIST_FILE" >&2
exit 1
fi

mkdir -p "$OUT_DIR"

while IFS= read -r ref || [ -n "$ref" ]; do
# strip leading/trailing whitespace
ref=$(echo "$ref" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//')
# skip blanks and comments
case "$ref" in
''|\#*) continue ;;
esac

# filename-safe version of the ref
fname=$(echo "$ref" | tr '/:@' '___').tar

# the load-time tag inside the archive: strip any @digest suffix
load_tag=$(echo "$ref" | sed 's/@.*//')

echo "==> $ref"
echo " -> $OUT_DIR/$fname (tag: $load_tag)"

skopeo copy \
"docker://$ref" \
"docker-archive:$OUT_DIR/$fname:$load_tag"

done < "$LIST_FILE"
17 changes: 17 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,23 @@ do
break
done

# Load preloaded images
if [ -d /preloaded-images ] && [ -n "$(ls -A /preloaded-images 2>/dev/null)" ]; then
echo "$(date) - Loading preloaded images (parallel)"
pids=""
for tar in /preloaded-images/*.tar; do
[ -f "$tar" ] || continue
(
echo "Loading $tar ..."
docker load -i "$tar" >/dev/null 2>&1 \
|| echo "WARNING: failed to load $tar"
) &
pids="$pids $!"
done
for pid in $pids; do wait "$pid"; done
echo "$(date) - Finished loading preloaded images"
fi

# Starting monitor
${DIR}/monitor/start.sh <&- &
MONITOR_PID=$!
Expand Down
2 changes: 1 addition & 1 deletion service.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 3.0.15
version: 4.0.0
Loading