Skip to content

Commit

Permalink
feat: reduce container image size by +/- 50% (+/- 4MB)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinelfrink committed Jun 14, 2023
1 parent bc0f352 commit eabe71a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
FROM alpine:3.18.0 AS build
RUN mkdir -p /build/etc/apk /build/var/run /empty
RUN mkdir -p /build/etc/apk /build/var/run
RUN cp -r /etc/apk/* /build/etc/apk/
RUN apk add --no-cache --initdb -p /build qemu-guest-agent musl

FROM scratch
COPY --from=build /build/bin /bin
COPY --from=build /build/etc /etc
COPY --from=build /build/lib /lib
COPY --from=build /build/sbin /sbin
COPY --from=build /build/usr /usr
COPY --from=build /build/var /var
COPY --from=build /build/usr/bin/qemu-ga /usr/bin/qemu-ga
COPY --from=build /build/lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1
COPY --from=build /build/usr/lib/libnuma.so.1 /usr/lib/libnuma.so.1
COPY --from=build /build/usr/lib/liburing.so.2 /usr/lib/liburing.so.2
COPY --from=build /build/usr/lib/libglib-2.0.so.0 /usr/lib/libglib-2.0.so.0
COPY --from=build /build/usr/lib/libgmodule-2.0.so.0 /usr/lib/libgmodule-2.0.so.0
COPY --from=build /build/usr/lib/libintl.so.8 /usr/lib/libintl.so.8
COPY --from=build /build/usr/lib/libpcre2-8.so.0 /usr/lib/libpcre2-8.so.0
COPY --from=build /build/var/run /var/run

CMD ["/usr/bin/qemu-ga", "--method", "virtio-serial", "--path", "/dev/virtio-ports/org.qemu.guest_agent.0"]

0 comments on commit eabe71a

Please sign in to comment.