diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-and-push.yaml index 918f802..fb9df03 100644 --- a/.github/workflows/build-and-push.yaml +++ b/.github/workflows/build-and-push.yaml @@ -62,6 +62,7 @@ jobs: cat <> ${{ matrix.nftables }}-multi-stage.Dockerfile FROM --platform=${{ env.PLATFORM }} ${{ matrix.base }} COPY --from=${{ env.TAG_TEST }} /criu/ / + RUN apk --update --no-cache add libnet libnl3 nftables protobuf-c EOF if [[ $? != 0 ]]; then diff --git a/README.md b/README.md index 37c000f..eae0ef1 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,7 @@ then: FROM --platform=amd64 alpine:3.18.5@sha256:d695c3de6fcd8cfe3a6222b0358425d40adfd129a8a47c3416faff1a8aece389 COPY --from=criu-with-nftables:criu-3.19-alpine-3.18.5 /criu/ / + +# Install deps +RUN apk --update --no-cache add libnet libnl3 nftables protobuf-c ``` diff --git a/multi-stage-setup.py b/multi-stage-setup.py deleted file mode 100644 index d30e074..0000000 --- a/multi-stage-setup.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python3 - -from pathlib import Path -from shutil import copy2 -from subprocess import run -from sys import exit - -CRIU_ROOT = '/criu' -CRIU_BIN_DIR = f'{CRIU_ROOT}/usr/bin' - - -def setup_criu_root(): - Path(CRIU_ROOT).mkdir(parents=True, exist_ok=False) - Path(CRIU_BIN_DIR).mkdir(parents=True, exist_ok=False) - - if not run(f'cp `which criu` {CRIU_BIN_DIR}', shell=True).returncode == 0: - exit(1) - - -def copy_dep(dep): - dep_dir = str(Path(CRIU_ROOT).joinpath(Path(dep).parent.relative_to('/'))) - Path(dep_dir).mkdir(parents=True, exist_ok=True) - - copy2(dep, dep_dir) - - -if __name__ == '__main__': - setup_criu_root() - - res = run('ldd `which criu`', capture_output=True, shell=True) - if not res.returncode == 0: - exit(1) - - deps = res.stdout.decode().strip().split("\n") - - for dep in deps: - parts = dep.strip().split(' => ') - if len(parts) not in (1, 2): - exit(1) - - part1 = None - part2 = None - - if len(parts) == 1: - part1 = parts[0].split(' (0x')[0] - part2 = part1 - else: - part2 = parts[1].split(' (0x')[0] - part1 = str(Path(part2).parent.joinpath(parts[0])) - - if not part1 or not part2: - exit(1) - - copy_dep(part1) - - if part1 != part2: - copy_dep(part2) diff --git a/with-nftables.Dockerfile b/with-nftables.Dockerfile index e4385fa..e8d3309 100644 --- a/with-nftables.Dockerfile +++ b/with-nftables.Dockerfile @@ -12,7 +12,6 @@ RUN apk --update --no-cache add \ procps \ gcc \ git \ - gnutls-dev \ libaio-dev \ libcap-dev \ libnet-dev \ @@ -29,14 +28,11 @@ RUN apk --update --no-cache add \ libdrm-dev \ util-linux -WORKDIR /tmp - RUN wget "http://github.com/checkpoint-restore/criu/archive/v${CRIU_VERSION}/criu-${CRIU_VERSION}.tar.gz" && \ tar -xzf "criu-${CRIU_VERSION}.tar.gz" && \ cd "criu-${CRIU_VERSION}" && \ - make -j $(nproc) install-criu - -COPY multi-stage-setup.py multi-stage-setup.py - -RUN chmod +x multi-stage-setup.py && \ - ./multi-stage-setup.py + make -j $(nproc) CONFIG_AMDGPU=n PREFIX=/usr DESTDIR=/criu LIBDIR=/usr/lib LD=gcc install && \ + rm -f /criu/usr/lib/*.a && \ + rm -rf /criu/usr/lib/python3* && \ + rm -rf /criu/usr/libexec/compel/*.a && \ + rm -f /criu/usr/libexec/criu/scripts/systemd-autofs-restart.sh diff --git a/without-nftables.Dockerfile b/without-nftables.Dockerfile index 4f5996b..018f61b 100644 --- a/without-nftables.Dockerfile +++ b/without-nftables.Dockerfile @@ -12,7 +12,6 @@ RUN apk --update --no-cache add \ procps \ gcc \ git \ - gnutls-dev \ libaio-dev \ libcap-dev \ libnet-dev \ @@ -27,14 +26,11 @@ RUN apk --update --no-cache add \ libdrm-dev \ util-linux -WORKDIR /tmp - RUN wget "http://github.com/checkpoint-restore/criu/archive/v${CRIU_VERSION}/criu-${CRIU_VERSION}.tar.gz" && \ tar -xzf "criu-${CRIU_VERSION}.tar.gz" && \ cd "criu-${CRIU_VERSION}" && \ - make -j $(nproc) install-criu - -COPY multi-stage-setup.py multi-stage-setup.py - -RUN chmod +x multi-stage-setup.py && \ - ./multi-stage-setup.py + make -j $(nproc) CONFIG_AMDGPU=n PREFIX=/usr DESTDIR=/criu LIBDIR=/usr/lib LD=gcc install && \ + rm -f /criu/usr/lib/*.a && \ + rm -rf /criu/usr/lib/python3* && \ + rm -rf /criu/usr/libexec/compel/*.a && \ + rm -f /criu/usr/libexec/criu/scripts/systemd-autofs-restart.sh