Skip to content

Instantly share code, notes, and snippets.

@ontouchstart
Last active April 3, 2026 21:59
Show Gist options
  • Select an option

  • Save ontouchstart/93a25bbda4015b4263a36049c662b877 to your computer and use it in GitHub Desktop.

Select an option

Save ontouchstart/93a25bbda4015b4263a36049c662b877 to your computer and use it in GitHub Desktop.
define DOCKERFILE
FROM debian:bookworm-slim@sha256:f06537653ac770703bc45b4b113475bd402f451e85223f0f2837acbf89ab020a
RUN apt-get update -qq && apt-get install -qq -y git
RUN rm -rf /var/lib/apt/lists/*
WORKDIR /home
# A fork of https://gist.github.com/alganet/2b89c4368f8d23d033961d8a3deb5c19
RUN git clone https://gist.github.com/ontouchstart/281d044cdcfaef22df3c0c389a81f499
RUN printf 'int main(){puts("hello");return 0;}' | sh 281d044cdcfaef22df3c0c389a81f499/c89cc.sh > hello
RUN chmod +x hello
CMD ["./hello"]
endef
export DOCKERFILE
all:
@echo "Run this outside of a docker container"
cat -n Makefile
Dockerfile:
@echo "$$DOCKERFILE" > Dockerfile
docker build -t gist .
hello: Dockerfile
docker run -it --rm gist
clean:
-docker rmi gist
-rm Dockerfile
@ontouchstart
Copy link
Copy Markdown
Author

sam@Sams-MacBook-Pro 03 % make 
Run this outside of a docker container
cat -n Makefile
     1	define DOCKERFILE
     2	FROM debian:bookworm-slim@sha256:f06537653ac770703bc45b4b113475bd402f451e85223f0f2837acbf89ab020a
     3	
     4	RUN apt-get update -qq && apt-get install -qq -y git
     5	
     6	RUN rm -rf /var/lib/apt/lists/*
     7	
     8	WORKDIR /home
     9	
    10	# A fork https://gist.github.com/alganet/2b89c4368f8d23d033961d8a3deb5c19
    11	RUN git clone https://gist.github.com/ontouchstart/281d044cdcfaef22df3c0c389a81f499
    12	RUN printf 'int main(){puts("hello");return 0;}' | sh 281d044cdcfaef22df3c0c389a81f499/c89cc.sh > hello
    13	RUN chmod +x hello
    14	CMD ["./hello"]
    15	endef
    16	
    17	export DOCKERFILE
    18	
    19	all:
    20		@echo "Run this outside of a docker container"
    21		cat -n Makefile
    22	
    23	Dockerfile:
    24		@echo "$$DOCKERFILE" > Dockerfile
    25		docker build -t gist .
    26	
    27	hello:	Dockerfile
    28		docker run -it --rm gist 
    29	
    30	clean:
    31		-docker rmi gist
    32		-rm Dockerfile
sam@Sams-MacBook-Pro 03 % make hello
docker build -t gist .
[+] Building 0.9s (11/11) FINISHED                                                                               docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                             0.0s
 => => transferring dockerfile: 537B                                                                                             0.0s
 => [internal] load metadata for docker.io/library/debian:bookworm-slim@sha256:f06537653ac770703bc45b4b113475bd402f451e85223f0f  0.0s
 => [internal] load .dockerignore                                                                                                0.0s
 => => transferring context: 2B                                                                                                  0.0s
 => [1/7] FROM docker.io/library/debian:bookworm-slim@sha256:f06537653ac770703bc45b4b113475bd402f451e85223f0f2837acbf89ab020a    0.0s
 => => resolve docker.io/library/debian:bookworm-slim@sha256:f06537653ac770703bc45b4b113475bd402f451e85223f0f2837acbf89ab020a    0.0s
 => CACHED [2/7] RUN apt-get update -qq && apt-get install -qq -y git                                                            0.0s
 => CACHED [3/7] RUN rm -rf /var/lib/apt/lists/*                                                                                 0.0s
 => CACHED [4/7] WORKDIR /home                                                                                                   0.0s
 => CACHED [5/7] RUN git clone https://gist.github.com/ontouchstart/281d044cdcfaef22df3c0c389a81f499                             0.0s
 => [6/7] RUN printf 'int main(){puts("hello");return 0;}' | sh 281d044cdcfaef22df3c0c389a81f499/c89cc.sh > hello                0.6s
 => [7/7] RUN chmod +x hello                                                                                                     0.1s
 => exporting to image                                                                                                           0.1s
 => => exporting layers                                                                                                          0.0s
 => => exporting manifest sha256:e4b4fd3b44f4c54284d466406a840fcfb7058bb880092d9a4e0c173f3aa36eba                                0.0s
 => => exporting config sha256:4928a6619e1198a1026519cea60360f607f5eb0f6a0649790c6bd078d8228533                                  0.0s
 => => exporting attestation manifest sha256:073b8b45861fa014b78c7faf9a88b326eecd91b547fd0e4132f5416691665382                    0.0s
 => => exporting manifest list sha256:83d802ed5c3216d60511aa0678d2663d2f013483c10d9dfba19b0d91ae883ba8                           0.0s
 => => naming to docker.io/library/gist:latest                                                                                   0.0s
 => => unpacking to docker.io/library/gist:latest                                                                                0.0s
docker run -it --rm gist 
hello
sam@Sams-MacBook-Pro 03 % make hello
docker run -it --rm gist 
hello

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment