-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (30 loc) · 1.19 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
# this stage will be rebuilt only when build.gradle.kts is changed
FROM gradle:7.6-jdk17-alpine as deps
# /home/gradle/.gradle in parent Gradle Docker image is defined as volume and is erased after each image layer
RUN mkdir -p /gradle_cache
ENV GRADLE_USER_HOME /gradle_cache
WORKDIR /app
COPY libs ./libs
COPY build.gradle.kts settings.gradle.kts ./
# /dev/null for skipping errors
RUN gradle clean build --no-daemon > /dev/null 2>&1 || true
# --------------------------------------------------
FROM gradle:7.6-jdk17-alpine as build
COPY --from=deps /gradle_cache /home/gradle/.gradle
WORKDIR /app
COPY src ./src
COPY libs ./libs
COPY build.gradle.kts settings.gradle.kts ./
RUN gradle bootJar -i --stacktrace --no-daemon
# --------------------------------------------------
FROM openjdk:17-jdk-alpine as runner
WORKDIR /app
ADD indecies/*.tar.gz /var/lucene_indices/
RUN addgroup -g 10001 -S java \
&& adduser -S spring -u 10001 \
&& chown spring:java /var/lucene_indices -R
COPY --chown=spring:java application.properties logback.xml ./
COPY --from=build --chown=spring:java /app/build/libs/vocabulario*.jar ./vocabulario.jar
USER spring
EXPOSE 8080
CMD [ "java", "-jar", "vocabulario.jar" ]