Last active
September 6, 2018 04:36
-
-
Save AlecTaylor/e0ee95881b6803cdead108ad3a1ecb3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine | |
RUN apk add --no-cache gcc musl-dev | |
ADD env.c /env.c | |
RUN gcc -static -o /env /env.c -Wno-implicit-function-declaration | |
FROM scratch | |
COPY --from=0 /env /env | |
ENTRYPOINT ["/env"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, char **argv, char** envp) { for(char** env=envp;*env!=0;env++) puts(*env, "\n"); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker build --compress --squash --force-rm --tag "${PWD##*/}" . | |
Sending build context to Docker daemon 357B | |
Step 1/7 : FROM alpine | |
latest: Pulling from library/alpine | |
8e3ba11ec2a2: Already exists | |
Digest: sha256:7043076348bf5040220df6ad703798fd8593a0918d06d3ce30c6c93be117e430 | |
Status: Downloaded newer image for alpine:latest | |
---> 11cd0b38bc3c | |
Step 2/7 : RUN apk add --no-cache gcc musl-dev | |
---> Running in 3d3e7bf3fcdd | |
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz | |
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz | |
(1/12) Installing binutils (2.30-r5) | |
(2/12) Installing gmp (6.1.2-r1) | |
(3/12) Installing isl (0.18-r0) | |
(4/12) Installing libgomp (6.4.0-r8) | |
(5/12) Installing libatomic (6.4.0-r8) | |
(6/12) Installing pkgconf (1.5.3-r0) | |
(7/12) Installing libgcc (6.4.0-r8) | |
(8/12) Installing mpfr3 (3.1.5-r1) | |
(9/12) Installing mpc1 (1.0.3-r1) | |
(10/12) Installing libstdc++ (6.4.0-r8) | |
(11/12) Installing gcc (6.4.0-r8) | |
(12/12) Installing musl-dev (1.1.19-r10) | |
Executing busybox-1.28.4-r0.trigger | |
OK: 99 MiB in 25 packages | |
Removing intermediate container 3d3e7bf3fcdd | |
---> c91ce4d7d290 | |
Step 3/7 : ADD env.c /env.c | |
---> b8d74fb55c38 | |
Step 4/7 : RUN gcc -static -o /env /env.c -Wno-implicit-function-declaration | |
---> Running in 5d65a7634564 | |
Removing intermediate container 5d65a7634564 | |
---> 67ef1cb241da | |
Step 5/7 : FROM scratch | |
---> | |
Step 6/7 : COPY --from=0 /env /env | |
---> d8ebacb21942 | |
Step 7/7 : ENTRYPOINT ["/env"] | |
---> Running in c7844c2514c8 | |
Removing intermediate container c7844c2514c8 | |
---> 727b7bbfd0ac | |
Successfully built 390f409f8c32 | |
Successfully tagged tmm:latest | |
$ docker run --rm "${PWD##*/}" -e IMSET=1 | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
HOSTNAME=b65d45c6440c | |
HOME=/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment