move image download to before deps layer

This commit is contained in:
Julian
2026-01-23 11:26:33 +10:00
parent 6a87b62e06
commit 0138b7c970
+12 -12
View File
@@ -23,6 +23,18 @@ ENV PATH="/usr/local/go/bin:/root/go/bin:${PATH}"
# Set up working directory structure to match development layout
WORKDIR /root/Development/mulga
# Pre-download Ubuntu cloud image for e2e tests (cached in Docker layer)
# Placed before dependency copy so go.mod changes don't invalidate this layer
RUN mkdir -p /root/images && \
ARCH=$(dpkg --print-architecture) && \
if [ "$ARCH" = "amd64" ]; then \
curl -L -o /root/images/ubuntu-24.04.img \
https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img; \
elif [ "$ARCH" = "arm64" ]; then \
curl -L -o /root/images/ubuntu-24.04.img \
https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-arm64.img; \
fi
# 1. Pre-copy dependency manifests for cache layer
COPY hive/go.mod hive/go.sum ./hive/
COPY viperblock/go.mod viperblock/go.sum ./viperblock/
@@ -38,18 +50,6 @@ RUN --mount=type=cache,target=/root/go/pkg/mod \
(cd viperblock/nbd/libguestfs.org/nbdkit && go mod download) && \
(cd predastore && go mod download)
# Pre-download Ubuntu cloud image for e2e tests (cached in Docker layer)
# Placed before source copy so code changes don't invalidate this layer
RUN mkdir -p /root/images && \
ARCH=$(dpkg --print-architecture) && \
if [ "$ARCH" = "amd64" ]; then \
curl -L -o /root/images/ubuntu-24.04.img \
https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img; \
elif [ "$ARCH" = "arm64" ]; then \
curl -L -o /root/images/ubuntu-24.04.img \
https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-arm64.img; \
fi
# 3. Copy the rest of the source code
COPY hive/ ./hive/
COPY viperblock/ ./viperblock/