Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(skeleton): reduce image size #984

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions skeleton/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
FROM ghcr.io/automattic/vip-container-images/alpine:3.20.3@sha256:42ee5e50414b7c636fa5ee8b0d1c6b0219bb413285e4110178b16416711f52c9
FROM alpine:3.20.3@sha256:1e42bbe2508154c9126d48c2b8a75420c3544343bf86fd041fb7527e017a4b4a AS build

RUN apk add --no-cache --virtual build-deps git && \
git clone --depth=1 https://github.com/Automattic/vip-go-skeleton/ /clientcode && \
rm -rf /clientcode/.git && \
apk del --no-cache build-deps
ENV SOURCE_DATE_EPOCH=0

CMD ["sleep", "infinity"]
RUN \
apk add --no-cache gcc git musl-dev && \
mkdir -p /target/bin && \
echo 'int main() { return 0; }' > /true.c && \
gcc -o /target/bin/true /true.c -Os -s -static && \
git clone --depth=1 https://github.com/Automattic/vip-go-skeleton/ /target/clientcode && \
rm -rf /target/clientcode/.git

FROM scratch
COPY --from=build /target /
CMD ["/bin/true"]
Loading