-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from graalvm/sms-revisions
Upgraded Tiny Containers
- Loading branch information
Showing
18 changed files
with
99 additions
and
53 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 |
---|---|---|
|
@@ -30,6 +30,10 @@ jobs: | |
# | ||
./setup-musl.sh | ||
# | ||
# Download upx | ||
# | ||
./setup-upx.sh | ||
# | ||
# Hello World | ||
# | ||
cd helloworld | ||
|
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
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,7 +1,9 @@ | ||
#!/bin/sh | ||
|
||
set -x | ||
set +e | ||
|
||
rm -rf x86_64-linux-musl-native zlib-* | ||
./helloworld/clean.sh | ||
./jwebserver/clean.sh | ||
cd helloworld | ||
./clean.sh || true | ||
cd ../jwebserver | ||
./clean.sh || true |
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,20 +1,20 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
TOOLCHAIN_DIR=`pwd`/../x86_64-linux-musl-native | ||
CC=${TOOLCHAIN_DIR}/bin/gcc | ||
PATH=${TOOLCHAIN_DIR}/bin:${PATH} | ||
|
||
set -x | ||
|
||
# Compile Java source file | ||
javac Hello.java | ||
|
||
# Compile Java bytecodes into a fully statically linked executable | ||
native-image --static --libc=musl -o hello Hello | ||
rm *.txt | ||
native-image -Ob --static --libc=musl -o hello Hello | ||
rm -rf *.txt | ||
|
||
# Create a compressed version of the executable | ||
upx --lzma --best hello -o hello.upx | ||
../upx --lzma --best hello -o hello.upx | ||
|
||
# Package the compressed executable in a simple scratch container image | ||
docker build . -t hello:upx |
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,6 +1,8 @@ | ||
#!/bin/sh | ||
|
||
rm hello hello.upx | ||
rm *.txt | ||
rm *.class | ||
docker images -q hello | awk '{print($1)}' | xargs docker rmi | ||
set +e | ||
|
||
rm -rf hello hello.upx | ||
rm -rf *.txt | ||
rm -rf *.class | ||
docker images -q hello | awk '{print($1)}' | xargs docker rmi || true |
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,4 +1,4 @@ | ||
FROM alpine | ||
FROM alpine:3 | ||
COPY jwebserver.static / | ||
COPY index.html /web/index.html | ||
EXPOSE 8000 | ||
|
2 changes: 1 addition & 1 deletion
2
tiny-java-containers/jwebserver/Dockerfile.distroless-base.mostly
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
2 changes: 1 addition & 1 deletion
2
tiny-java-containers/jwebserver/Dockerfile.distroless-java-base.dynamic
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
2 changes: 1 addition & 1 deletion
2
tiny-java-containers/jwebserver/Dockerfile.distroless-java-base.jlink
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
2 changes: 1 addition & 1 deletion
2
tiny-java-containers/jwebserver/Dockerfile.distroless-static.static
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
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,6 +1,4 @@ | ||
#!/bin/sh | ||
|
||
set -x | ||
#!/bin/sh | ||
|
||
./build-dynamic.sh | ||
./build-mostly.sh | ||
|
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
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
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,6 +1,6 @@ | ||
#!/bin/sh | ||
|
||
native-image -H:+StaticExecutableWithDynamicLibC -m jdk.httpserver -o jwebserver.mostly | ||
native-image -Ob -H:+UnlockExperimentalVMOptions -H:+StaticExecutableWithDynamicLibC -m jdk.httpserver -o jwebserver.mostly | ||
|
||
# Distroless Base (provides glibc) | ||
docker build . -f Dockerfile.distroless-base.mostly -t jwebserver:distroless-base.mostly |
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
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,5 +1,8 @@ | ||
#!/bin/sh | ||
|
||
set +e | ||
|
||
rm -rf jwebserver-jlink/ | ||
rm jwebserver.dynamic jwebserver.mostly jwebserver.static jwebserver.static-upx | ||
rm -rf svm*.md | ||
docker images jwebserver -q | grep -v TAG | awk '{print($1)}' | xargs docker rmi |
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,5 +1,7 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
ZLIB_VERSION=1.2.13 | ||
TOOLCHAIN_DIR=`pwd`/x86_64-linux-musl-native | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
UPX_VERSION=4.2.2 | ||
UPX_ARCHIVE=upx-${UPX_VERSION}-amd64_linux.tar.xz | ||
|
||
wget -q https://github.com/upx/upx/releases/download/v${UPX_VERSION}/${UPX_ARCHIVE} | ||
tar -xJf ${UPX_ARCHIVE} | ||
rm -rf ${UPX_ARCHIVE} | ||
mv upx-${UPX_VERSION}-amd64_linux/upx . | ||
rm -rf upx-${UPX_VERSION}-amd64_linux | ||
|