-
-
Notifications
You must be signed in to change notification settings - Fork 79
/
Dockerfile.builder.linux-amd64-static
43 lines (31 loc) · 1.42 KB
/
Dockerfile.builder.linux-amd64-static
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM debian:11
RUN apt-get update -y &&\
apt-get install --force-yes -y build-essential libz-dev zlib1g-dev curl
ARG RESULT_LIB="/musl"
RUN mkdir ${RESULT_LIB} && \
curl -L -o musl.tar.gz https://more.musl.cc/10.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz && \
tar -xvzf musl.tar.gz -C musl --strip-components 1 && \
cp /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a ${RESULT_LIB}/lib/
ENV CC=/musl/bin/gcc
RUN curl -L -o zlib.tar.gz https://www.zlib.net/fossils/zlib-1.2.11.tar.gz && \
mkdir zlib && tar -xvzf zlib.tar.gz -C zlib --strip-components 1 && \
cd zlib && ./configure --static --prefix=/musl && \
make && make install && \
cd / && rm -rf /zlib && rm -f /zlib.tar.gz
ENV PATH="$PATH:/musl/bin"
ENV GRAALVM_URL='https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz'
RUN mkdir /graalvm &&\
curl -L $GRAALVM_URL > /tmp/graalvm.tgz &&\
tar --strip 1 -zxvf /tmp/graalvm.tgz -C /graalvm &&\
rm -r /tmp/* || true
ENV JAVA_HOME=/graalvm
ENV PATH="${PATH}:$JAVA_HOME/bin"
RUN uname -a && whoami && $JAVA_HOME/bin/java -version
WORKDIR /app/build
COPY ./build/artifacts/native-image-source/ /app/build
RUN ls -lha &&\
native-image --static --libc=musl -jar dns-proxy-server.jar dns-proxy-server
RUN ls -lhS &&\
mkdir -p ./artifacts/linux-amd64-static &&\
mv ./dns-proxy-server ./artifacts/linux-amd64-static/
ENTRYPOINT cat