-
-
Notifications
You must be signed in to change notification settings - Fork 194
/
Copy pathDockerfile
52 lines (45 loc) · 1.72 KB
/
Dockerfile
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
# syntax=docker.io/docker/dockerfile:1.7-labs
# Build stage
FROM eclipse-temurin:21-jdk-noble AS build
COPY --exclude=entrypoint.sh . /home/reposilite-build
WORKDIR /home/reposilite-build
# The below line will show an Error in some IDE's, It is valid Dockerfile.
RUN --mount=type=cache,target=/root/.gradle <<EOF
export GRADLE_OPTS="-Djdk.lang.Process.launchMechanism=vfork"
./gradlew :reposilite-backend:shadowJar --no-daemon --stacktrace
EOF
# Build-time metadata stage
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Reposilite" \
org.label-schema.description="Lightweight repository management software dedicated for the Maven artifacts" \
org.label-schema.url="https://reposilite.com" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/dzikoysk/reposilite" \
org.label-schema.vendor="dzikoysk" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"
# Run stage
FROM eclipse-temurin:21-jre-noble AS run
# Setup runtime environment
RUN mkdir -p /app/data && mkdir -p /var/log/reposilite
VOLUME /app/data
RUN <<EOF
mkdir -p /app/data
mkdir -p /var/log/reposilite
EOF
WORKDIR /app
# Import application code
COPY --chmod=755 entrypoint.sh entrypoint.sh
COPY --from=build /home/reposilite-build/reposilite-backend/build/libs/reposilite-3*.jar reposilite.jar
HEALTHCHECK --interval=30s --timeout=30s --start-period=15s \
--retries=3 CMD [ "sh", "-c", "URL=$(cat /app/data/.local/reposilite.address); echo -n \"curl $URL... \"; \
(\
curl -sf $URL > /dev/null\
) && echo OK || (\
echo Fail && exit 2\
)"]
ENTRYPOINT ["/app/entrypoint.sh"]
EXPOSE 8080