37 lines
1.2 KiB
Docker
37 lines
1.2 KiB
Docker
# Use a specific version of OpenJDK based on Debian ("bullseye" in this case)
|
|
FROM --platform=$BUILDPLATFORM openjdk:21-jdk-bullseye AS builder
|
|
|
|
# Replace 'apk' commands with 'apt-get' for Debian-based package management.
|
|
# Install required packages such as 'git' and 'gradle'. Remember to update and clean up properly.
|
|
RUN apt-get update && \
|
|
apt-get install -y gradle git && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /mxids
|
|
COPY . .
|
|
RUN ./gradlew shadowJar
|
|
|
|
# Second stage: Setup the runtime container
|
|
FROM openjdk:21-jdk-bullseye
|
|
|
|
# Again, switch to 'apt-get' for installing 'bash'. Clean up to keep the image size down.
|
|
RUN apt-get update && \
|
|
apt-get install -y bash && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
VOLUME /etc/mxids
|
|
VOLUME /var/mxids
|
|
EXPOSE 8090
|
|
|
|
ENV JAVA_OPTS=""
|
|
ENV CONF_FILE_PATH="/etc/mxids/mxids.yaml"
|
|
ENV SIGN_KEY_PATH="/var/mxids/sign.key"
|
|
ENV SQLITE_DATABASE_PATH="/var/mxids/mxids.db"
|
|
|
|
# It's usually a good practice to use 'COPY' instead of 'ADD' for local files unless you need the extra capabilities of 'ADD' (like auto-extracting tar files).
|
|
COPY src/docker/start.sh /start.sh
|
|
COPY src/script/mxids /app/mxids
|
|
COPY --from=builder /mxids/build/libs/mxids.jar /app/mxids.jar
|
|
|
|
CMD ["/start.sh"]
|