Dockerfile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # 1) use alpine to generate a void environment
  2. FROM alpine:3.12 as stage0
  3. ARG REPOSITORY=https://repo-default.voidlinux.org
  4. ARG ARCH=x86_64
  5. COPY keys/* /target/var/db/xbps/keys/
  6. RUN apk add ca-certificates curl && \
  7. curl ${REPOSITORY}/static/xbps-static-latest.$(uname -m)-musl.tar.xz | \
  8. tar Jx && \
  9. XBPS_ARCH=${ARCH} xbps-install.static -yMU \
  10. --repository=${REPOSITORY}/current \
  11. --repository=${REPOSITORY}/current/musl \
  12. -r /target \
  13. base-minimal
  14. # 2) using void to generate the final build
  15. FROM scratch as stage1
  16. ARG REPOSITORY=https://repo-default.voidlinux.org
  17. ARG ARCH=x86_64
  18. ARG BASEPKG=base-minimal
  19. COPY --from=stage0 /target /
  20. COPY keys/* /target/var/db/xbps/keys/
  21. RUN xbps-reconfigure -a && \
  22. mkdir -p /target/var/cache && ln -s /var/cache/xbps /target/var/cache/xbps && \
  23. XBPS_ARCH=${ARCH} xbps-install -yMU \
  24. --repository=${REPOSITORY}/current \
  25. --repository=${REPOSITORY}/current/musl \
  26. -r /target \
  27. ${BASEPKG}
  28. # 3) configure and clean up the final image
  29. FROM scratch
  30. COPY --from=stage1 /target /
  31. RUN xbps-reconfigure -a && \
  32. rm -r /var/cache/xbps
  33. CMD ["/bin/sh"]