-
Notifications
You must be signed in to change notification settings - Fork 207
/
Dockerfile
84 lines (64 loc) · 2.48 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
74
75
76
77
78
79
80
81
82
83
84
FROM sbtscala/scala-sbt:eclipse-temurin-jammy-8u352-b08_1.9.0_2.12.17 AS builder
#build varaibles
#ENV SBT_VERSION 1.1.5
ENV PROJECT_HOME=/usr/src
#RUN mkdir -p $PROJECT_HOME/activator $PROJECT_HOME/app
RUN apt-get update && apt-get install -y \
unzip \
&& rm -rf /var/lib/apt/lists/*
#WORKDIR $PROJECT_WORKPLACE/activator
#RUN wget https://downloads.typesafe.com/typesafe-activator/1.3.6/typesafe-activator-1.3.6.zip && \
# unzip typesafe-activator-1.3.6.zip && chmod a+x activator-dist-1.3.6/activator
#ENV PATH $PATH:/activator-1.3.6
# Install Play Framework
#RUN curl -O https://downloads.typesafe.com/typesafe-activator/1.3.6/typesafe-activator-1.3.6.zip
#RUN unzip typesafe-activator-1.3.6.zip -d / && rm typesafe-activator-1.3.6.zip && ls && sudo chmod a+x /activator-dist-1.3.6/activator
# Install curl
#RUN \
# apt-get update && \
# apt-get -y install curl
# Install sbt
#RUN \
#mkdir /working/ && \
#cd /working/ && \
#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 sbt && \
#cd && \
#rm -r /working/ && \
#sbt sbtVersion
COPY Build.sbt .
COPY project ./project
RUN --mount=type=cache,target=/root/.ivy2 \
--mount=type=cache,target=/root/.sbt \
sbt update
# Setup path variables and copy fEMR into container
#ENV PATH $PROJECT_HOME/activator/activator-dist-1.3.10/bin:$PATH
#ENV PATH $PROJECT_WORKPLACE/build/target/universal/stage/bin:$PATH
COPY . $PROJECT_HOME/app
COPY ../speedtest /usr/src/speedtest
WORKDIR $PROJECT_HOME/app
RUN \
rm $PROJECT_HOME/app/conf/application.conf && \
mv $PROJECT_HOME/app/conf/application.docker.conf $PROJECT_HOME/app/conf/application.conf
#RUN sbt clean compile
RUN --mount=type=cache,target=/root/.ivy2 \
--mount=type=cache,target=/root/.sbt \
sbt dist
WORKDIR $PROJECT_HOME/app/target/universal
RUN unzip femr-*.zip && rm femr-*.zip
FROM openjdk:jre-alpine
RUN apk add --no-cache bash python3 py3-pip gcc python3-dev musl-dev linux-headers
RUN pip3 install psutil
#database variables
ENV DB_URL="jdbc:mysql://localhost:3306/femr_db?characterEncoding=UTF-8&useSSL=false"
ENV DB_USER="username"
ENV DB_PASS="password"
COPY --from=builder /usr/src/app/target/universal/femr-* /opt/bin/femr
#open port 9000 for connections
EXPOSE 9000
# run fEMR using env variables
#ENTRYPOINT url=$DB_URL usr=$DB_USER pass=$DB_PASS sbt ~run
ENTRYPOINT ["/bin/bash", "-c", "/opt/bin/femr/bin/femr"]