forked from dzikoysk/reposilite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
70 lines (59 loc) · 2.05 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# syntax=docker.io/docker/dockerfile:1.7-labs
# Build stage
FROM bellsoft/liberica-runtime-container:jdk-21-musl AS build
COPY --exclude=entrypoint.sh . /home/reposilite-build
WORKDIR /home/reposilite-build
# Get build dependencies seperately so they can cache
RUN <<EOF
apk --no-cache add nodejs
EOF
# 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 bellsoft/liberica-runtime-container:jre-21-slim-musl AS run
# Run everything at the lowest possible permissions
ARG PGID="977"
ARG PUID="977"
VOLUME /app/data
RUN <<EOF
mkdir -p /app/data
mkdir -p /var/log/reposilite
addgroup -Sg "$PGID" reposilite
adduser -SH \
-h /app \
-s "/usr/sbin/nologin" \
-G reposilite \
-u "$PUID" reposilite
EOF
WORKDIR /app
COPY --from=build /home/reposilite-build/reposilite-backend/build/libs/reposilite-3*.jar reposilite.jar
COPY --chmod=755 entrypoint.sh entrypoint.sh
RUN <<EOF
chown -R "$PUID:$PGID" /app /var/log/reposilite
EOF
USER reposilite
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