diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8e94d2d4..0e5e0b14 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,9 +26,15 @@ jobs: - name: Create dockerfile for Ubuntu run: | cat << END > Dockerfile + FROM rust:bookworm as builder + RUN apt update + RUN apt install -y --no-install-recommends libcap-ng-dev libseccomp-dev + RUN RUSTFLAGS='-C target-feature=+crt-static -C link-self-contained=yes' LIBSECCOMP_LINK_TYPE=static LIBSECCOMP_LIB_PATH=/usr/lib LIBCAPNG_LINK_TYPE=static LIBCAPNG_LIB_PATH=/usr/lib cargo install --tag v1.13.1 --git https://gitlab.com/virtio-fs/virtiofsd.git FROM ubuntu:latest RUN apt update - RUN apt install -y --no-install-recommends libcap-ng0 libseccomp2 qemu-system-x86 net-tools virtiofsd + RUN apt install -y --no-install-recommends libcap-ng0 libseccomp2 qemu-system-x86 net-tools + COPY --from=builder /usr/local/cargo/bin/virtiofsd /usr/bin/virtiofsd + RUN chmod 0755 /usr/bin/virtiofsd END - name: Build and push container uses: docker/build-push-action@v6 @@ -39,8 +45,13 @@ jobs: - name: Create dockerfile for Alpine run: | cat << END > Dockerfile + FROM alpine:latest as builder + RUN apk add --no-cache rust cargo libseccomp-dev libcap-ng-dev + RUN RUSTFLAGS='-C target-feature=+crt-static -C link-self-contained=yes' LIBSECCOMP_LINK_TYPE=static LIBSECCOMP_LIB_PATH=/usr/lib LIBCAPNG_LINK_TYPE=static LIBCAPNG_LIB_PATH=/usr/lib cargo install --tag v1.13.1 --git https://gitlab.com/virtio-fs/virtiofsd.git FROM alpine:latest - RUN apk add --no-cache qemu qemu-system-x86_64 libseccomp libcap-ng virtiofsd + RUN apk add --no-cache qemu qemu-system-x86_64 libseccomp libcap-ng + COPY --from=builder /root/.cargo/bin/virtiofsd /usr/bin/virtiofsd + RUN chmod 0755 /usr/bin/virtiofsd END - name: Build and push container uses: docker/build-push-action@v6