Dockerfile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ##### BUILDER #####
  2. FROM alpine:3.11 as builder
  3. ## Task: artifacts, tools and configs
  4. COPY ./target/spsassembler.jar /service/spsassembler.jar
  5. COPY ./content/ /
  6. ## Task: filesystem permissions
  7. RUN set -eux; \
  8. chown -R 0.0 /config \
  9. /service; \
  10. chmod 0777 /*.sh \
  11. /config \
  12. /service; \
  13. chmod 0666 /config/* \
  14. /service/*
  15. ## Task: runtime dependencies
  16. # hadolint ignore=DL3018
  17. RUN set -eux; \
  18. apk add --no-progress --quiet --no-cache --upgrade --virtual .run-deps \
  19. tzdata
  20. # hadolint ignore=DL3018,SC2183,DL4006
  21. RUN set -eu +x; \
  22. apk add --no-progress --quiet --no-cache --upgrade ncurses; \
  23. apk update --quiet; \
  24. printf '%30s\n' | tr ' ' -; \
  25. echo "RUNTIME DEPENDENCIES"; \
  26. PKGNAME=$(apk info --depends .run-deps \
  27. | sed '/^$/d;/depends/d' \
  28. | sort -u ); \
  29. printf '%s\n' "${PKGNAME}" \
  30. | while IFS= read -r pkg; do \
  31. apk info --quiet --description --no-network "${pkg}" \
  32. | sed -n '/description/p' \
  33. | sed -r "s/($(echo "${pkg}" | sed -r 's/\+/\\+/g'))-(.*)\s.*/\1=\2/"; \
  34. done \
  35. | tee -a /usr/share/rundeps; \
  36. printf '%30s\n' | tr ' ' -
  37. ##### TARGET #####
  38. FROM adoptopenjdk/openjdk14:alpine-slim
  39. ARG IMG_VERSION
  40. ENV IMG_VERSION="${IMG_VERSION}" \
  41. CLASSPATH=".:/service/*" \
  42. CONFIGFILE="config/config.yaml" \
  43. JAVA_OPTS="-XX:+ExitOnOutOfMemoryError -XshowSettings:vm -XX:-UsePerfData -XX:NativeMemoryTracking=summary"
  44. COPY --from=builder /*.sh /
  45. COPY --from=builder /config /config
  46. COPY --from=builder /service /service
  47. COPY --from=builder /usr/share/rundeps /usr/share/rundeps
  48. RUN set -eux; \
  49. xargs -a /usr/share/rundeps apk add --no-progress --quiet --no-cache --upgrade --virtual .run-deps; \
  50. mkdir -m 0777 /opt/data
  51. EXPOSE 8080 8081
  52. HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=10s \
  53. CMD wget -q -T 5 --spider --no-check-certificate http://localhost:8081/healthcheck
  54. ENTRYPOINT ["/entrypoint.sh"]
  55. LABEL org.opencontainers.image.title="SPSAssembler" \
  56. org.opencontainers.image.description="SPSAssembler" \
  57. org.opencontainers.image.version="${IMG_VERSION}" \
  58. org.opencontainers.image.source="https://wkla.no-ip.biz/gogs/Willie/SPS_Emulator_Java.git" \
  59. org.opencontainers.image.vendor="MCS" \
  60. org.opencontainers.image.authors="wkla" \
  61. maintainer="MCS" \
  62. NAME="SPSAssembler"