-
Notifications
You must be signed in to change notification settings - Fork 2
Create Docker Image
How to create a Docker Image with Webelexis.
- Install Docker
- Either (1a) run a prebuilt image or (1b) create a new one.
- Then (2) configure your webelexis app in the docker container
docker run -t -i -p 2015:2015 rgwch/webelexis-docker:1.0.0 sh
- Create an empty directory.
- In this directory, create a file named Dockerfile.
Here is the contents of that file:
FROM 1science/java:oracle-jdk-8
MAINTAINER weirich@elexis.ch
RUN apk add --update git nodejs nano
RUN wget http://ftp.fau.de/apache/maven/maven-3/3.3.1/binaries/apache-maven-3.3.1-bin.tar.gz
RUN tar -xzf apache-maven-3.3.1-bin.tar.gz
RUN rm -f apache-maven-3.3.1-bin.tar.gz
RUN mv apache-maven-3.3.1 /usr/lib/mvn
ENV M2_HOME=/usr/lib/mvn
ENV M2=$M2_HOME/bin
ENV PATH $PATH:$M2_HOME:$M2
RUN npm install -g mimosa
RUN adduser -D -s bash webelexis
USER webelexis
WORKDIR /home/webelexis
RUN git clone https://github.com/rgwch/webelexis
WORKDIR /home/webelexis/webelexis/webelexis-client
RUN mimosa build
WORKDIR /home/webelexis/webelexis/webelexis-server
RUN mvn package
EXPOSE 2015
WORKDIR /home/webelexis/webelexis/webelexis-server/target
RUN java -jar webelexis-server-1.0.0.jar
RUN cp cfglocal.json ../cfglocal.json
Open a terminal in that directory and enter:
docker build -t repository/name:tag .
(For 'repository/name:tag' enter something more convenient, e.g. 'rgwch/webelexis-docker:1.0.0') Don't forget the dot at the end of the line. The command will take quite al long time to finish. After that you'll have a docker image, based on the java machine from 1Science which in turn is based on Alpine Linux with a Webelexis environment installed.
To run a Container from this image, type docker run -t -i -p 2015:2015 repository/name:tag sh
You can edit /home/webelexis/webelexis/webelexis-server/cfglocal.json to match your system. After that, go to webelexis-server/target and enter java -jar webelexis-server-1.0.0.jar ../cfglocal.json
.
This will run your webelexis server. But how can you reach it?
In Linux, navigate your browser to localhost:2015. In Windows and Mac find out the address of the docker machine: boot2docker ip
. Use that ip:2015 to connect.