summaryrefslogtreecommitdiff
path: root/contrib/helloimage/Containerfile
diff options
context:
space:
mode:
authortomsweeneyredhat <tsweeney@redhat.com>2022-02-10 12:28:42 -0500
committertomsweeneyredhat <tsweeney@redhat.com>2022-02-10 15:45:04 -0500
commit40ba9f10e5fbdd3c9d36389107b8bf1caec6cef0 (patch)
tree1aa7eda5aeb0d5aa44f3358d137568d04e892e29 /contrib/helloimage/Containerfile
parent6d2b54a731cf5ac9a7e760709748ee96a636d65e (diff)
downloadpodman-40ba9f10e5fbdd3c9d36389107b8bf1caec6cef0.tar.gz
podman-40ba9f10e5fbdd3c9d36389107b8bf1caec6cef0.tar.bz2
podman-40ba9f10e5fbdd3c9d36389107b8bf1caec6cef0.zip
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 <tsweeney@redhat.com>
Diffstat (limited to 'contrib/helloimage/Containerfile')
-rw-r--r--contrib/helloimage/Containerfile13
1 files changed, 8 insertions, 5 deletions
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"]