Skip to content

Commit

Permalink
Merge pull request #96 from PBH-BTN/docker
Browse files Browse the repository at this point in the history
Use 2-stage Dockerfile to ensure image reproducible
  • Loading branch information
Ghost-chu authored Apr 29, 2024
2 parents a657146 + 176a558 commit 2d2ca6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
30 changes: 12 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
FROM eclipse-temurin:17.0.10_7-jre
FROM maven:3.9.6-eclipse-temurin-22 as build

LABEL MAINTAINER="https://github.com/PBH-BTN/PeerBanHelper"

ENV TZ=UTC PUID=0 PGID=0

RUN set -ex && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && \
apt-get install -y gosu dumb-init && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ADD . /build
WORKDIR /build
RUN sh setup-webui.sh && mvn -B clean package --file pom.xml

FROM ubuntu/jre:17_edge
LABEL MAINTAINER="https://github.com/PBH-BTN/PeerBanHelper"
USER 0
ENV TZ=UTC
WORKDIR /app

COPY --chmod=755 ./docker-entrypoint.sh /app/

COPY ./target/PeerBanHelper.jar /app/

ENTRYPOINT [ "/app/docker-entrypoint.sh" ]
VOLUME /tmp
COPY --from=build build/target/PeerBanHelper.jar /app/PeerBanHelper.jar
ENV PATH "${JAVA_HOME}/bin:${PATH}"
ENTRYPOINT ["java","-Xmx256M","-XX:+UseSerialGC","-jar","PeerBanHelper.jar"]
2 changes: 1 addition & 1 deletion setup-webui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ current_wd=$(pwd)
cd "$(dirname $0)/src/main/resources"
rm -rf static
git clone --depth 1 --branch gh-pages "https://github.com/PBH-BTN/pbh-fe.git" static
echo "WebUI Version: $(git rev-parse --short HEAD)"
cd static && echo "WebUI Version: $(git rev-parse --short HEAD)"
cd $current_wd

0 comments on commit 2d2ca6b

Please sign in to comment.