-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(skeleton): reduce image size
- Loading branch information
Showing
1 changed file
with
13 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
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"] |