diff --git a/Makefile b/Makefile index 9912510..2ebbf46 100644 --- a/Makefile +++ b/Makefile @@ -24,10 +24,22 @@ out/gcc.oci.tgz: \ out/musl.oci.tgz docker build -t ocirep/gcc --output type=oci,dest=$@ packages/gcc +out/make.oci.tgz: \ + out/bootstrap.oci.tgz \ + out/musl.oci.tgz + docker build -t ocirep/make --output type=oci,dest=$@ packages/make + out/bash.oci.tgz: \ out/gcc.oci.tgz docker build -t ocirep/bash --output type=oci,dest=$@ packages/bash +out/openssl.oci.tgz: \ + out/gcc.oci.tgz \ + out/binutils.oci.tgz \ + out/busybox.oci.tgz \ + out/musl.oci.tgz + docker build -t ocirep/openssl --output type=oci,dest=$@ packages/openssl + out/go.oci.tgz: \ out/gcc.oci.tgz \ out/binutils.oci.tgz \ @@ -36,8 +48,35 @@ out/go.oci.tgz: \ out/musl.oci.tgz docker build -t ocirep/go --output type=oci,dest=$@ packages/go +out/perl.oci.tgz: \ + out/gcc.oci.tgz \ + out/binutils.oci.tgz \ + out/busybox.oci.tgz \ + out/musl.oci.tgz + docker build -t ocirep/perl --output type=oci,dest=$@ packages/perl + +out/python.oci.tgz: \ + out/gcc.oci.tgz \ + out/perl.oci.tgz \ + out/binutils.oci.tgz \ + out/busybox.oci.tgz \ + out/openssl.oci.tgz \ + out/make.oci.tgz \ + out/musl.oci.tgz + docker build -t ocirep/python --output type=oci,dest=$@ packages/python + test: - docker build -t ocirep/go_hello examples/go_hello + docker build -t ocirep/test-c tests/c + docker build -t ocirep/test-go tests/go + docker build -t ocirep/test-python tests/python + docker build -t ocirep/test-perl tests/perl + @printf "\nOcirep Test Suite\n" - @printf "go_hello -> " - @docker run -i ocirep/go_hello | grep Success + @printf "go -> " + @docker run -i ocirep/test-go | grep Success + @printf "c -> " + @docker run -i ocirep/test-c | grep Success + @printf "perl -> " + @docker run -i ocirep/test-perl | grep Success + @printf "python -> " + @docker run -i ocirep/test-python | grep Success diff --git a/packages/make/Dockerfile b/packages/make/Dockerfile new file mode 100644 index 0000000..fa1b117 --- /dev/null +++ b/packages/make/Dockerfile @@ -0,0 +1,28 @@ +FROM ocirep/musl:latest as musl +FROM ocirep/bootstrap:latest as build + +ENV SRC_SITE https://ftp.gnu.org/gnu/make +ENV SRC_VERSION 4.4 +ENV SRC_HASH 581f4d4e872da74b3941c874215898a7d35802f03732bdccee1d4a7979105d18 + +RUN wget ${SRC_SITE}/make-${SRC_VERSION}.tar.gz +RUN echo "${SRC_HASH} make-${SRC_VERSION}.tar.gz" | sha256sum -c +RUN tar -xf make-${SRC_VERSION}.tar.gz +WORKDIR make-${SRC_VERSION} +RUN set -ex; \ + ./configure \ + --build=x86_64-linux-musl \ + --host=x86_64-linux-musl \ + --target=x86_64-linux-musl \ + --prefix=/usr \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --disable-nls; \ + make -j "$(nproc)"; \ + make DESTDIR="/rootfs" install; +COPY --from=musl /lib/libc.so /rootfs/lib/ld-musl-x86_64.so.1 + +FROM scratch +COPY --from=build /rootfs / +ENTRYPOINT ["/usr/bin/make"] +CMD ["--version"] diff --git a/packages/openssl/Dockerfile b/packages/openssl/Dockerfile new file mode 100644 index 0000000..422f21c --- /dev/null +++ b/packages/openssl/Dockerfile @@ -0,0 +1,51 @@ +FROM ocirep/busybox:latest as busybox +FROM ocirep/gcc:latest as gcc +FROM ocirep/binutils:latest as binutils +FROM ocirep/musl:latest as musl +FROM ocirep/make:latest as make +FROM ocirep/perl:latest as perl +FROM ocirep/linux-headers:latest as linux-headers + +FROM busybox as build +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=musl . / +COPY --from=perl . / +COPY --from=linux-headers . / +ENV SRC_SITE=https://www.openssl.org/source +ENV SRC_VERSION=3.0.12 +ENV SRC_HASH=f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61 +RUN wget ${SRC_SITE}/openssl-${SRC_VERSION}.tar.gz +RUN echo "${SRC_HASH} openssl-${SRC_VERSION}.tar.gz" | sha256sum -c +RUN tar -xf openssl-${SRC_VERSION}.tar.gz +WORKDIR openssl-${SRC_VERSION} +RUN set -eux; \ + export CC='gcc -fPIE -pie -static'; \ + perl ./Configure \ + --prefix=/usr \ + --libdir=lib \ + --openssldir=/etc/ssl \ + --static \ + -static \ + enable-ktls \ + no-shared \ + no-zlib \ + no-async \ + no-comp \ + no-idea \ + no-mdc2 \ + no-rc5 \ + no-ec2m \ + no-ssl3 \ + no-seed \ + no-weak-ssl-ciphers \ + linux-x86_64; \ + make; \ + make DESTDIR=/home/user/rootfs install + +FROM scratch +COPY --from=build /home/user/rootfs / +USER 100:100 +ENTRYPOINT ["/usr/bin/openssl"] +CMD ["version"] diff --git a/packages/perl/Dockerfile b/packages/perl/Dockerfile new file mode 100644 index 0000000..4ecf7f3 --- /dev/null +++ b/packages/perl/Dockerfile @@ -0,0 +1,55 @@ +FROM ocirep/busybox:latest as busybox +FROM ocirep/gcc:latest as gcc +FROM ocirep/binutils:latest as binutils +FROM ocirep/musl:latest as musl +FROM ocirep/make:latest as make + +FROM busybox as build +ENV SRC_SITE=https://www.cpan.org/src/5.0 +ENV SRC_VERSION=5.38.0 +ENV SRC_HASH=eca551caec3bc549a4e590c0015003790bdd1a604ffe19cc78ee631d51f7072e +RUN wget ${SRC_SITE}/perl-${SRC_VERSION}.tar.xz +RUN echo "${SRC_HASH} perl-${SRC_VERSION}.tar.xz" | sha256sum -c +RUN tar -xf perl-${SRC_VERSION}.tar.xz +WORKDIR perl-${SRC_VERSION} +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=musl . / +RUN set -eux; \ + ./Configure \ + -des \ + -Dcccdlflags='-fPIC' \ + -Dccdlflags='-rdynamic' \ + -Dprefix=/usr \ + -Dvendorprefix=/usr \ + -Dvendorlib=/usr/share/perl5/vendor_perl \ + -Dvendorarch=/usr/lib/perl5/vendor_perl \ + -Dsiteprefix=/usr/local \ + -Dsitelib=/usr/local/share/perl5/site_perl \ + -Dsitearch=/usr/local/lib/perl5/site_perl \ + -Dlocincpth=' ' \ + -Duselargefiles \ + -Dusethreads \ + -Duseshrplib \ + -Dcc=gcc \ + -Dd_semctl_semun \ + -Dman1dir=/usr/share/man/man1 \ + -Dman3dir=/usr/share/man/man3 \ + -Dinstallman1dir=/usr/share/man/man1 \ + -Dinstallman3dir=/usr/share/man/man3 \ + -Dman1ext='1' \ + -Dman3ext='3pm' \ + -Ud_csh \ + -Ud_fpos64_t \ + -Ud_off64_t \ + -Dusenm; \ + make; \ + make DESTDIR=/home/user/rootfs install +COPY --from=musl /lib/libc.so /home/user/rootfs/lib/ld-musl-x86_64.so.1 + +FROM scratch +COPY --from=build /home/user/rootfs / +USER 100:100 +ENTRYPOINT ["/usr/bin/perl"] +CMD ["--version"]