From 40ba9f10e5fbdd3c9d36389107b8bf1caec6cef0 Mon Sep 17 00:00:00 2001 From: tomsweeneyredhat Date: Thu, 10 Feb 2022 12:28:42 -0500 Subject: Make the hello image leaner [NO TESTS NEEDED] Change from using a bash script to a c file for running the image. With thanks to discussions with @afbjorklund, the Containerfile was rigged up to make the final image be only KB's in size. Also add USER 1000 to make the image test/run as non-root, and update the README.md Signed-off-by: tomsweeneyredhat --- contrib/helloimage/Containerfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'contrib/helloimage/Containerfile') diff --git a/contrib/helloimage/Containerfile b/contrib/helloimage/Containerfile index bea71cae0..0cbf6d9a0 100644 --- a/contrib/helloimage/Containerfile +++ b/contrib/helloimage/Containerfile @@ -1,8 +1,11 @@ -FROM registry.access.redhat.com/ubi8-micro:latest +FROM docker.io/alpine as builder +RUN apk add gcc libc-dev +ADD podman_hello_world.c . +RUN gcc -O2 -static -o podman_hello_world podman_hello_world.c +FROM scratch LABEL maintainer="Podman Maintainers" LABEL artist="Máirín Ní Ḋuḃṫaiġ, Twitter:@mairin" -WORKDIR /tmp - -COPY podman_hello_world.bash . -ENTRYPOINT ./podman_hello_world.bash +USER 1000 +COPY --from=builder podman_hello_world /usr/local/bin/podman_hello_world +CMD ["/usr/local/bin/podman_hello_world"] -- cgit v1.2.3-54-g00ecf