##### BUILDER ##### FROM alpine:3.11 as builder ## Task: artifacts, tools and configs COPY ./target/spsassembler.jar /service/spsassembler.jar COPY ./content/ / ## Task: filesystem permissions RUN set -eux; \ chown -R 0.0 /config \ /service; \ chmod 0777 /*.sh \ /config \ /service; \ chmod 0666 /config/* \ /service/* ## Task: runtime dependencies # hadolint ignore=DL3018 RUN set -eux; \ apk add --no-progress --quiet --no-cache --upgrade --virtual .run-deps \ tzdata # hadolint ignore=DL3018,SC2183,DL4006 RUN set -eu +x; \ apk add --no-progress --quiet --no-cache --upgrade ncurses; \ apk update --quiet; \ printf '%30s\n' | tr ' ' -; \ echo "RUNTIME DEPENDENCIES"; \ PKGNAME=$(apk info --depends .run-deps \ | sed '/^$/d;/depends/d' \ | sort -u ); \ printf '%s\n' "${PKGNAME}" \ | while IFS= read -r pkg; do \ apk info --quiet --description --no-network "${pkg}" \ | sed -n '/description/p' \ | sed -r "s/($(echo "${pkg}" | sed -r 's/\+/\\+/g'))-(.*)\s.*/\1=\2/"; \ done \ | tee -a /usr/share/rundeps; \ printf '%30s\n' | tr ' ' - ##### TARGET ##### FROM adoptopenjdk/openjdk14:alpine-slim ARG IMG_VERSION ENV IMG_VERSION="${IMG_VERSION}" \ CLASSPATH=".:/service/*" \ CONFIGFILE="config/config.yaml" \ JAVA_OPTS="-XX:+ExitOnOutOfMemoryError -XshowSettings:vm -XX:-UsePerfData -XX:NativeMemoryTracking=summary" COPY --from=builder /*.sh / COPY --from=builder /config /config COPY --from=builder /service /service COPY --from=builder /usr/share/rundeps /usr/share/rundeps RUN set -eux; \ xargs -a /usr/share/rundeps apk add --no-progress --quiet --no-cache --upgrade --virtual .run-deps; \ mkdir -m 0777 /opt/data EXPOSE 8080 8081 HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=10s \ CMD wget -q -T 5 --spider --no-check-certificate http://localhost:8081/healthcheck ENTRYPOINT ["/entrypoint.sh"] LABEL org.opencontainers.image.title="SPSAssembler" \ org.opencontainers.image.description="SPSAssembler" \ org.opencontainers.image.version="${IMG_VERSION}" \ org.opencontainers.image.source="https://wkla.no-ip.biz/gogs/Willie/SPS_Emulator_Java.git" \ org.opencontainers.image.vendor="MCS" \ org.opencontainers.image.authors="wkla" \ maintainer="MCS" \ NAME="SPSAssembler"