-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
89 lines (75 loc) · 2.33 KB
/
Dockerfile
File metadata and controls
89 lines (75 loc) · 2.33 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# GraalVM Docker Image with Shell
# Multi-arch: linux/amd64, linux/arm64
# Expected size: ~365MB
FROM debian:stable-slim AS downloader
ARG GRAALVM_VERSION=25.0.2
ARG TARGETARCH
WORKDIR /tmp
# Map Docker's TARGETARCH to GraalVM's architecture naming
RUN case "${TARGETARCH}" in \
amd64) echo "linux-x64" > /tmp/graalvm_arch ;; \
arm64) echo "linux-aarch64" > /tmp/graalvm_arch ;; \
*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
esac
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
# Download and extract GraalVM directly
RUN GRAALVM_ARCH=$(cat /tmp/graalvm_arch) \
&& curl -fsSL "https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${GRAALVM_VERSION}/graalvm-community-jdk-${GRAALVM_VERSION}_${GRAALVM_ARCH}_bin.tar.gz" \
-o graalvm.tar.gz \
&& mkdir -p /opt/graalvm \
&& tar -xzf graalvm.tar.gz -C /opt/graalvm --strip-components=1 \
&& rm graalvm.tar.gz
# Remove unnecessary components to save space
# Remove GUI libraries since RESTHeart is a server application
RUN cd /opt/graalvm \
&& rm -rf \
lib/src.zip \
lib/visualvm \
lib/static \
lib/svm \
jmods \
man \
demo \
sample \
include \
&& cd lib \
&& rm -rf \
libnative-image*.so \
libjavafx*.so \
libprism*.so \
libglass*.so \
libfx*.so \
libjfx*.so \
libgstreamer*.so \
libsplashscreen.so \
ct.sym \
2>/dev/null || true
# Final stage
FROM debian:stable-slim
LABEL maintainer="SoftInstigate <info@softinstigate.com>"
LABEL description="GraalVM image with shell for debugging"
LABEL org.opencontainers.image.source="https://github.com/SoftInstigate/graalvm-docker"
# Copy only the JVM from builder
COPY --from=downloader /opt/graalvm /opt/graalvm
# Install minimal runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
locales \
&& echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.UTF-8 \
&& apt-get -y autoremove \
&& rm -rf /var/lib/apt/lists/*
ENV JAVA_HOME=/opt/graalvm
ENV PATH="${JAVA_HOME}/bin:${PATH}"
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
ENV JAVA_OPTS="-Djava.awt.headless=true"
WORKDIR /opt/app
# Use shell entrypoint for flexibility
CMD ["/bin/sh"]