-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLocalDockerBuildAndPush
More file actions
47 lines (32 loc) · 1.47 KB
/
Copy pathLocalDockerBuildAndPush
File metadata and controls
47 lines (32 loc) · 1.47 KB
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
FROM registry.access.redhat.com/ubi8/openjdk-11 AS builder
ENV ARTIFACT_NAME=service-0.0.1-SNAPSHOT.jar
ENV APP_DIR=/usr/app/devscafe/service
ENV GCP_PROFILER_AGENT=https://storage.googleapis.com/cloud-profiler/java/latest/profiler_java_agent.tar.gz
ENV GCP_DEBUGGER_AGENT=https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz
USER root
RUN microdnf install -y wget
RUN microdnf install -y gzip
WORKDIR ${APP_DIR}
ADD ./build/libs/$ARTIFACT_NAME ${APP_DIR}/build/libs/$ARTIFACT_NAME
RUN java -Djarmode=layertools -jar ${APP_DIR}/build/libs/$ARTIFACT_NAME extract
# Create a directory for the Profiler. Add and unzip the agent in the directory.
RUN mkdir -p /opt/cprof
RUN wget -q -O- $GCP_PROFILER_AGENT | tar xzv -C /opt/cprof
# Create a directory for the Debugger. Add and unzip the agent in the directory.
RUN mkdir /opt/cdbg
RUN wget -qO- $GCP_DEBUGGER_AGENT | tar xvz -C /opt/cdbg
FROM registry.access.redhat.com/ubi8/openjdk-11
ENV APP_DIR=/usr/app/devscafe/service
WORKDIR ${APP_DIR}
USER root
RUN chown -R 185 ${APP_DIR}
RUN chmod -R 777 ${APP_DIR}
USER 185
COPY --from=builder /opt/cprof /opt/cprof
COPY --from=builder /opt/cdbg /opt/cdbg
COPY --from=builder ${APP_DIR}/dependencies/ ./
COPY --from=builder ${APP_DIR}/spring-boot-loader/ ./
COPY --from=builder ${APP_DIR}/snapshot-dependencies/ ./
COPY --from=builder ${APP_DIR}/application/ ./
RUN mkdir ${APP_DIR}/logs
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]