-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.api
68 lines (51 loc) · 2.05 KB
/
Dockerfile.api
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
FROM openjdk:11-slim
##
## This Dockerfile setups the SysML v2 API server and is designed to be
## run in conjunction with the Jupyter server. This dockerfile is specifically
## designed to be run with docker compose.
##
RUN apt-get --quiet --yes update && apt-get install -yqq wget
##
## Use a non-root user for installation
##
ARG NB_USER=sysml
ARG NB_UID=1000
ENV USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
USER root
RUN chown -R ${NB_UID} ${HOME}
## Switch to the lowly user, no more root.
USER ${NB_USER}
WORKDIR ${HOME}
ARG SBT_VERSION=1.2.8
RUN wget -q https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.tgz
## Defining the RELEASE down here ensures that the previous comamnds can
## be recycled since they're not affected by the release version.
ARG RELEASE=2023-02
RUN wget -q https://github.com/Systems-Modeling/SysML-v2-API-Services/archive/${RELEASE}.tar.gz?ts=20220819Z020300 00 -O ${RELEASE}.tar.gz
RUN tar xfz sbt-${SBT_VERSION}.tgz
RUN tar xfz ${RELEASE}.tar.gz
WORKDIR ${HOME}/SysML-v2-API-Services-${RELEASE}
##
## Basically this is all taken from
## https://github.com/Systems-Modeling/SysML-v2-API-Services
## and the installation instructions over there.
##
RUN ${HOME}/sbt/bin/sbt clean
RUN ${HOME}/sbt/bin/sbt update
RUN ${HOME}/sbt/bin/sbt compile
## Play framework complains about the secret key length...
RUN sed s/key=.whatever./key=\"longersecretnowarnings\"/ -i conf/application.conf
## need to allow the jupyter server access to the API server
RUN echo "\n\nplay.filters.hosts {\n allowed = [\"sysmlapiserver:9500\", \"localhost:9500\"]\n}\n" >> conf/application.conf
## point the image to the postgres that is setup via docker compose
RUN sed s/localhost:5432/postgresdbserver:5432/ -i conf/META-INF/persistence.xml
## don't recreate the database if it already exists.
RUN sed s/value=.create-drop./value=\"update\"/ -i conf/META-INF/persistence.xml
EXPOSE 9500
ENTRYPOINT ${HOME}/sbt/bin/sbt run