This repository was archived by the owner on Oct 3, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathDockerfile.integration
More file actions
113 lines (96 loc) · 3.83 KB
/
Copy pathDockerfile.integration
File metadata and controls
113 lines (96 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Dockerfile for integration tests with containerd and erofs snapshotter
# Build: docker build -t erofs-snapshotter-integration -f Dockerfile.integration .
# Run: docker run --privileged --rm erofs-snapshotter-integration
#
# This is a base image with runtime dependencies only.
# Go binaries (erofs-snapshotter, integration-commit) are built on the host
# and mounted at runtime for faster iteration.
#
# Multi-stage build:
# - Stage 1 (erofs-builder): Builds erofs-utils from source
# - Stage 2 (runtime): Minimal Ubuntu with only runtime dependencies
ARG NERDCTL_VERSION=2.3.1
ARG UBUNTU_VERSION=26.04
# =============================================================================
# Stage 1: Build erofs-utils
# =============================================================================
FROM ubuntu:${UBUNTU_VERSION} AS erofs-builder
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
autoconf \
automake \
libtool \
pkg-config \
uuid-dev \
liblz4-dev \
libzstd-dev \
zlib1g-dev \
liblzma-dev \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy and run the erofs-utils build script
COPY scripts/build-erofs-utils.sh /tmp/build-erofs-utils.sh
RUN /tmp/build-erofs-utils.sh /usr/local
# =============================================================================
# Stage 2: Runtime image
# =============================================================================
FROM ubuntu:${UBUNTU_VERSION}
# OCI labels for GitHub Container Registry
LABEL org.opencontainers.image.source=https://github.com/spin-stack/erofs-snapshotter
LABEL org.opencontainers.image.description="Integration test environment for erofs snapshotter"
LABEL org.opencontainers.image.licenses=Apache-2.0
# Install runtime dependencies only
RUN apt-get update && apt-get install -y --no-install-recommends \
e2fsprogs \
kmod \
ca-certificates \
iptables \
runc \
fuse3 \
procps \
liblz4-1 \
libzstd1 \
zlib1g \
liblzma5 \
libuuid1 \
xxd \
isal \
jq \
&& rm -rf /var/lib/apt/lists/*
# Copy erofs-utils binaries from builder
COPY --from=erofs-builder /usr/local/bin/mkfs.erofs /usr/local/bin/
COPY --from=erofs-builder /usr/local/bin/fsck.erofs /usr/local/bin/
COPY --from=erofs-builder /usr/local/bin/dump.erofs /usr/local/bin/
# Verify erofs-utils installation
RUN mkfs.erofs --version
# Note: Go binaries (spin-erofs-snapshotter, integration-commit) are built on
# the host and mounted at runtime. See run-integration-tests.sh for details.
# Install nerdctl (containerd + ctr + nerdctl bundle)
ARG NERDCTL_VERSION
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& curl -sSL "https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-full-${NERDCTL_VERSION}-linux-amd64.tar.gz" | \
tar -xz -C /usr/local \
&& apt-get purge -y curl \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# Create loop devices (up to loop31 for integration tests)
RUN for i in $(seq 0 31); do \
[ -e /dev/loop$i ] || mknod -m 0660 /dev/loop$i b 7 $i; \
done
# Create required directories
RUN mkdir -p \
/var/lib/containerd-test \
/var/lib/spin-stack/erofs-snapshotter \
/run/containerd \
/run/spin-stack/erofs-snapshotter \
/tmp/integration-logs
WORKDIR /workspace
# Note: Integration test script is mounted at runtime from scripts/ directory
# for faster iteration. The entrypoint script is a thin wrapper that calls it.
# Create entrypoint wrapper that runs the mounted script
RUN printf '#!/bin/bash\nexec /workspace/scripts/integration-test.sh "$@"\n' > /usr/local/bin/entrypoint.sh \
&& chmod +x /usr/local/bin/entrypoint.sh
# Default entrypoint runs integration tests via mounted script
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]