-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (28 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
40 lines (28 loc) · 1.03 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
FROM debian:12-slim AS build
RUN apt-get update && \
apt-get install -y wget gcc libz-dev maven && \
rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz && \
tar -xvzf graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz && \
rm graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz
# Set the GraalVM installation path
ENV GRAALVM_HOME=/graalvm-community-openjdk-21.0.2+13.1
ENV PATH=$GRAALVM_HOME/bin:$PATH
# Set working directory
WORKDIR /app
# Copy the Maven wrapper and project files
COPY . .
# Build the native image
RUN mvn -Pnative native:compile
# Use a lightweight runtime image for the final build
FROM frolvlad/alpine-glibc
# Set up workdir
WORKDIR /app
# Copy the native executable from the build stage
COPY --from=build /app/target/multi-tic-tac /app/multi-tic-tac
# Set executable permissions
RUN chmod +x /app/multi-tic-tac
# Expose application port
EXPOSE 10000
# Start the application
CMD ["./multi-tic-tac"]