-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
64 lines (61 loc) · 2.31 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# syntax=docker/dockerfile:latest
ARG BUILD_IMAGE=adoptopenjdk:11-jdk-hotspot
ARG JRE_IMAGE=adoptopenjdk:11-jre-hotspot
FROM $BUILD_IMAGE as build
ARG SBT_VERSION=1.7.2
SHELL [ "/bin/bash", "-cxe" ]
WORKDIR /tmp
RUN curl -sLo - https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.tgz | tar -xvzf -; \
mv sbt/bin/* /usr/local/bin/; \
rm -rf /tmp/*
WORKDIR /app
ENV JAVA_OPTS="-Xms4G -Xmx8G -Xss6M -XX:ReservedCodeCacheSize=256M -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC"
ENV JVM_OPTS="-Xms4G -Xmx8G -Xss6M -XX:ReservedCodeCacheSize=256M -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC"
ENV SBT_OPTS="-Xms4G -Xmx8G -Xss6M -XX:ReservedCodeCacheSize=256M -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC"
ARG APP_VERSION
ENV APP_VERSION=$APP_VERSION
COPY . .
RUN --mount=type=cache,target=/root/.sbt \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.ivy2 \
sbt dist; \
echo $APP_VERSION
FROM $BUILD_IMAGE as extract
SHELL [ "/bin/bash", "-cxe" ]
WORKDIR /app
RUN --mount=type=cache,target=/var/lib/apt/cache \
--mount=type=cache,target=/var/lib/cache \
apt update; \
apt install unzip -y
COPY --from=build /app/target/universal/ /app
RUN <<EOF
cp *.zip mantleplace.zip
ls -alt
unzip -q mantleplace.zip
ls -alt
rm *.zip
ls -alt
mv mantleplace* mantleplace
ls -alt
# awk 'NR==1{print; print "set -x"} NR!=1' mantleplace/bin/mantleplace > mantleplace/bin/mantleplace.tmp
# mv mantleplace/bin/mantleplace.tmp mantleplace/bin/mantleplace
# chmod +x mantleplace/bin/mantleplace
# head -n 10 mantleplace/bin/mantleplace
EOF
FROM $JRE_IMAGE
ARG APP_VERSION
ENV APP_VERSION=$APP_VERSION
LABEL org.opencontainers.image.title=mantleplace
LABEL org.opencontainers.image.base.name=$JRE_IMAGE
LABEL org.opencontainers.image.description=mantleplace
LABEL org.opencontainers.image.source=https://github.com/assetmantle/mantleplace
LABEL org.opencontainers.image.documentation=https://github.com/assetmantle/mantleplace
WORKDIR /
RUN --mount=type=cache,target=/var/lib/apt/cache \
--mount=type=cache,target=/var/lib/apt/lists \
--mount=type=cache,target=/var/lib/cache \
--mount=type=cache,target=/var/cache/apt/archives \
apt update; \
apt install -y openssl libexpat1 libsasl2-2 libssl1.1 libsasl2-modules-db
COPY --from=extract /app/mantleplace /mantleplace
ENTRYPOINT [ "/mantleplace/bin/mantleplace" ]