-
Notifications
You must be signed in to change notification settings - Fork 65
/
Dockerfile
56 lines (39 loc) · 1.25 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
##############
# BASE STAGE #
##############
FROM alpine:3.20 AS base
# Add OpenJDK17
RUN apk add openjdk17=17.0.12_p7-r0
# Uses /kepler directory
WORKDIR /kepler
###############
# BUILD STAGE #
###############
FROM base AS build
# Add unzip
RUN apk add unzip=6.0-r14
# Copy every files/folders that are not in .dockerignore
COPY . .
# Convert CRLF to LF executable files (failing build for Windows without this)
RUN sed -i 's/\r$//' gradlew tools/scripts/run.sh entrypoint.sh
# Make gradlew, entrypoint.sh and run.sh executable
RUN chmod +x gradlew entrypoint.sh tools/scripts/run.sh
# Run gradle build
RUN ./gradlew distZip
# Unzip builded Kepler server
RUN unzip -qq ./Kepler-Server/build/distributions/Kepler-Server.zip -d ./release
# Prepare build directory
RUN rm -rf ./release/Kepler-Server/bin && \
mkdir -p ./build/lib && \
mv ./release/Kepler-Server/lib/Kepler-Server.jar ./build/kepler.jar && \
mv ./release/Kepler-Server/lib/* ./build/lib && \
mv ./entrypoint.sh ./build/entrypoint.sh && \
cp tools/scripts/run.sh ./build/
####################
# PRODUCTION STAGE #
####################
FROM base AS production
# Copy builded Kepler server
COPY --from=build /kepler/build ./
ENTRYPOINT [ "sh", "entrypoint.sh" ]
CMD [ "sh", "run.sh" ]