-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile
73 lines (60 loc) · 1.93 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
65
66
67
68
69
70
71
72
73
#
# Builder image for the TS pipeline
#
FROM node:20-bookworm AS tsbuilder
COPY package.json /var/www/aplus/package.json
COPY typescript /var/www/aplus/typescript/
WORKDIR /var/www/aplus/
RUN npm install
RUN npm run build
#
# Builder image for the Scala app
# based on https://github.com/hseeberger/scala-sbt
#
FROM eclipse-temurin:17-jdk AS scalabuilder
# We need nodejs to run in a reasonable amount of time sbt-web
# see step `Optimizing JavaScript with RequireJS`
RUN apt-get update && apt-get install -y --no-install-recommends nodejs git
# Env variables
ENV SBT_VERSION 1.5.1
# Install sbt
RUN \
curl -L -o sbt-$SBT_VERSION.deb https://repo.scala-sbt.org/scalasbt/debian/sbt-$SBT_VERSION.deb && \
dpkg -i sbt-$SBT_VERSION.deb && \
rm sbt-$SBT_VERSION.deb && \
apt-get update && \
apt-get install -y --no-install-recommends sbt && \
sbt sbtVersion -Dsbt.rootdir=true
ENV PLAY_APP_NAME aplus
ENV PLAY_APP_DIR /var/www/$PLAY_APP_NAME
RUN mkdir -p $PLAY_APP_DIR
COPY .git $PLAY_APP_DIR/.git/
COPY build.sbt $PLAY_APP_DIR/
COPY app $PLAY_APP_DIR/app/
COPY macros $PLAY_APP_DIR/macros/
COPY conf $PLAY_APP_DIR/conf/
COPY public $PLAY_APP_DIR/public/
COPY --from=tsbuilder /var/www/aplus/public/generated-js $PLAY_APP_DIR/public/generated-js/
COPY project/*.properties project/*.sbt project/*.scala $PLAY_APP_DIR/project/
WORKDIR $PLAY_APP_DIR
ENV HOME $PLAY_APP_DIR
RUN sbt clean stage
#
#
# Final Image
#
#
FROM eclipse-temurin:17-jre
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libargon2-1 \
&& rm -rf /var/lib/apt/lists/*
ENV PLAY_APP_NAME aplus
ENV PLAY_APP_DIR /var/www/$PLAY_APP_NAME
ENV HOME $PLAY_APP_DIR
WORKDIR $PLAY_APP_DIR
COPY --from=scalabuilder $PLAY_APP_DIR/target/universal/stage $PLAY_APP_DIR
COPY data $PLAY_APP_DIR/data/
RUN chmod 554 $PLAY_APP_DIR/bin/$PLAY_APP_NAME
RUN chmod 774 $PLAY_APP_DIR
EXPOSE 9000
CMD ["sh", "-c", "$PLAY_APP_DIR/bin/$PLAY_APP_NAME $OPTIONS"]