-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
53 lines (38 loc) · 989 Bytes
/
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
#
# Download dependencies
#
FROM eclipse-temurin:23-jdk-alpine AS deps
WORKDIR /build
COPY --chmod=0755 gradlew gradlew
COPY settings.gradle /build/settings.gradle
COPY app/build.gradle /build/app/build.gradle
COPY gradle /build/gradle
RUN ./gradlew build --no-daemon
#
# Build fat jar
#
FROM deps AS package
WORKDIR /build
COPY ./app/src /build/app/src/
RUN ./gradlew shadowJar
#
# Final container
#
FROM eclipse-temurin:23-jre-alpine AS final
WORKDIR /app
RUN mkdir /app/config
# Create a non-privileged user that the app will run under
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
USER appuser
COPY --from=package /build/app/build/libs/app-all.jar /app/app.jar
COPY ./app/src/main/resources /app/defaultconfig
COPY ./db /app/db
ENTRYPOINT [ "java", "-cp", "app.jar:config:defaultconfig", "com.nicolauscg.reminder.discord.bot.App"]