-
Notifications
You must be signed in to change notification settings - Fork 189
/
Dockerfile_dev
38 lines (29 loc) · 1.34 KB
/
Dockerfile_dev
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
# set Java
ARG JAVA_VERSION=17.0.9_9
# extracts spring layers from the app jar (to optimize boot)
FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine as build
ARG HAWKBIT_APP=hawkbit-update-server
ARG HAWKBIT_VERSION=0-SNAPSHOT
ENV BUILD_DIR=/opt/hawkbit_build
ENV APP=${HAWKBIT_APP}
ENV VERSION=${HAWKBIT_VERSION}
COPY org/eclipse/hawkbit/${APP}/${VERSION}/${APP}-${VERSION}.jar ${APP}-${VERSION}.jar
RUN set -x &&\
mkdir -p ${BUILD_DIR} &&\
cd ${BUILD_DIR} &&\
java -Djarmode=layertools -jar /${APP}-${VERSION}.jar extract --destination . &&\
rm /${APP}-${VERSION}.jar
FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine
RUN addgroup -S hawkbit_group && adduser -D hawkbit -G hawkbit_group
RUN mkdir -p /artifactrepo && chown -R hawkbit /artifactrepo
USER hawkbit
ENV BUILD_DIR=/opt/hawkbit_build
COPY --from=build ${BUILD_DIR}/dependencies/ ./
COPY --from=build ${BUILD_DIR}/spring-boot-loader/ ./
COPY --from=build ${BUILD_DIR}/snapshot-dependencies/ ./
COPY --from=build ${BUILD_DIR}/application/ ./
ARG CONTAINER_PORT=8080
ENV JAVA_OPTS="-Xms768m -Xmx768m -XX:MaxMetaspaceSize=250m -XX:MetaspaceSize=250m -Xss300K -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError"
VOLUME "/artifactrepo"
EXPOSE ${CONTAINER_PORT}
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} org.springframework.boot.loader.launch.JarLauncher ${@}"]