-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 #2 from mkouba/docker-native-img
Make it possible to use docker to build native images
- Loading branch information
Showing
3 changed files
with
55 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM ubuntu:18.04 | ||
|
||
ARG GRAAL_VERSION | ||
ENV GRAAL_VERSION=${GRAAL_VERSION:-1.0.0-rc4} | ||
ENV GRAAL_CE_URL=https://github.com/oracle/graal/releases/download/vm-${GRAAL_VERSION}/graalvm-ce-${GRAAL_VERSION}-linux-amd64.tar.gz | ||
|
||
# Update system and install tools | ||
RUN apt-get update && \ | ||
apt-get install -y wget tar gzip gcc libc6-dev zlib1g-dev | ||
|
||
# Download and extract graalvm in tmp dir | ||
RUN cd /tmp | ||
RUN wget -q $GRAAL_CE_URL -O graalvm-ce-linux-amd64.tar.gz | ||
RUN tar -xvzf graalvm-ce-linux-amd64.tar.gz | ||
|
||
# Move extracted graalvm to /opt and cleanup | ||
RUN mkdir -p /opt/graalvm | ||
RUN mv graalvm-ce-${GRAAL_VERSION} /opt/graalvm | ||
RUN rm graalvm-ce-linux-amd64.tar.gz | ||
|
||
RUN apt-get clean | ||
|
||
ENV JAVA_HOME=/opt/graalvm/graalvm-ce-${GRAAL_VERSION} | ||
ENV PATH=$PATH:$JAVA_HOME/bin | ||
ENV GRAALVM_HOME=/opt/graalvm/graalvm-ce-${GRAAL_VERSION} | ||
|
||
VOLUME /project | ||
WORKDIR /project | ||
|
||
ENTRYPOINT ["native-image"] |
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,11 @@ | ||
# Build | ||
|
||
```bash | ||
docker build -t protean/graalvm-native-image:latest . | ||
``` | ||
|
||
# Run | ||
|
||
```bash | ||
docker run -it -v /path/to/protean/arc:/project --rm protean/graalvm-native-image -jar example/target/arc-example-shaded.jar | ||
``` |
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