Skip to content

Commit 31b9dcf

Browse files
committed
split frontend and backend images
1 parent 78d27c5 commit 31b9dcf

6 files changed

Lines changed: 82 additions & 100 deletions

File tree

README.md

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,2 @@
11
# Toolkit-Docker
2-
Dockerfiles for the toolkit's docker image. It should be built automatically by DockerCloud.
3-
4-
To build it manually, run:
5-
``docker image build -t "proteinevolution/toolkit-docker:1.1.6" -t "proteinevolution/toolkit-docker:latest" .``
6-
7-
To push the image, run:
8-
``docker push proteinevolution/toolkit-docker:latest``
9-
10-
## Using image with docker file
11-
12-
The most minimal `docker-compose.yml` file is:
13-
14-
```
15-
version: '3.7'
16-
services:
17-
sbt:
18-
image: proteinevolution/toolkit-docker:latest
19-
volumes:
20-
- .:/toolkit
21-
```
22-
23-
But it's not optimal if you have anything cached in `~/ivy2` which most probably you do if you develop Scala. To benefit from caching; thus reducing startup time, use the following:
24-
25-
```
26-
version: '3.7'
27-
services:
28-
sbt:
29-
image: proteinevolution/toolkit-docker:latest
30-
volumes:
31-
- .:/toolkit
32-
- ~/.ivy2:/root/.ivy2
33-
- ~/.sbt:/root/.sbt
34-
- ~/.coursier:/root/.coursier
35-
```
36-
37-
It's still the minimal version; in real project you will probably need to expose ports etc.
38-
39-
## Overriding CMD
40-
41-
By default (i.e. if you don't provide CMD in your `docker run` or `docker-compose.yml`) it will run sbt's `shell`. It's a reasonable default because from there you can invoke any SBT task you want.
42-
43-
If default does not fit your needs then override CMD in either `docker run` or `docker-compose.yml`. Example:
44-
45-
```
46-
docker run -v :.:/toolkit proteinevolution/toolkit-docker:latest projects test:compile
47-
```
48-
49-
Here we also used ability to "chain" sbt commands.
2+
Dockerfiles for the toolkit's docker images. They should be built automatically by DockerCloud.

Dockerfile renamed to backend/Dockerfile

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,9 @@ FROM hseeberger/scala-sbt:8u212_2.12.8_1.2.8
22

33
LABEL maintainer="fgabler@tue.mpg.de"
44

5-
# since scala-sbt is based on stretch-scm instead of stretch, install missing packages. see: https://github.com/docker-library/buildpack-deps/blob/d7da72aaf3bb93fecf5fcb7c6ff154cb0c55d1d1/stretch/Dockerfile
6-
RUN apt-get update && apt-get install -y --no-install-recommends \
7-
autoconf \
8-
automake \
9-
bzip2 \
10-
file \
11-
g++ \
12-
gcc \
13-
imagemagick \
14-
libbz2-dev \
15-
libc6-dev \
16-
libcurl4-openssl-dev \
17-
libevent-dev \
18-
libffi-dev \
19-
libgeoip-dev \
20-
libglib2.0-dev \
21-
libjpeg-dev \
22-
liblzma-dev \
23-
libmagickcore-dev \
24-
libmagickwand-dev \
25-
libncurses-dev \
26-
libpng-dev \
27-
libpq-dev \
28-
libreadline-dev \
29-
libsqlite3-dev \
30-
libssl-dev \
31-
libtool \
32-
libwebp-dev \
33-
libxml2-dev \
34-
libxslt-dev \
35-
libyaml-dev \
36-
make \
37-
patch \
38-
xz-utils \
39-
zlib1g-dev \
40-
&& rm -rf /var/lib/apt/lists/*
41-
42-
# install node and yarn
43-
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
44-
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
45-
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
46-
RUN apt-get update -qqy && apt-get -qqyy install \
47-
nodejs \
48-
yarn \
49-
&& rm -rf /var/lib/apt/lists/*
50-
515
ENV TK_BASE_PATH "/root/Toolkit"
526
ENV MAXMIND_DB "$TK_BASE_PATH/data/GeoLite2-City.mmdb"
537

54-
ENV CHOKIDAR_USEPOLLING=true
55-
568
RUN mkdir -p $TK_BASE_PATH/bioprogs/tools
579
RUN mkdir -p $TK_BASE_PATH/databases
5810
RUN mkdir -p $TK_BASE_PATH/data
@@ -100,13 +52,11 @@ WORKDIR /toolkit
10052

10153
RUN sbt update
10254

103-
# expose frontend port
104-
EXPOSE 8080
10555
# expose backend port
10656
EXPOSE 1234
10757

10858
RUN mv ~/.ivy2 ~/.ivy_image
109-
COPY ./docker-entrypoint.sh /
59+
COPY ../docker-entrypoint.sh /
11060
ENTRYPOINT ["/docker-entrypoint.sh"]
11161

11262
CMD ["shell"]

backend/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Toolkit Backend Docker Image
2+
Dockerfile for the toolkit's backend docker image. It should be built automatically by DockerCloud.
3+
4+
To build it manually, run:
5+
``docker image build -t "proteinevolution/toolkit-docker:1.1.6" -t "proteinevolution/toolkit-docker:latest" .``
6+
7+
To push the image, run:
8+
``docker push proteinevolution/toolkit-docker:latest``
9+
10+
## Using image with docker file
11+
12+
The most minimal `docker-compose.yml` file is:
13+
14+
```
15+
version: '3.7'
16+
services:
17+
sbt:
18+
image: proteinevolution/toolkit-docker:latest
19+
volumes:
20+
- .:/toolkit
21+
```
22+
23+
But it's not optimal if you have anything cached in `~/ivy2` which most probably you do if you develop Scala. To benefit from caching; thus reducing startup time, use the following:
24+
25+
```
26+
version: '3.7'
27+
services:
28+
sbt:
29+
image: proteinevolution/toolkit-docker:latest
30+
volumes:
31+
- .:/toolkit
32+
- ~/.ivy2:/root/.ivy2
33+
- ~/.sbt:/root/.sbt
34+
- ~/.coursier:/root/.coursier
35+
```
36+
37+
It's still the minimal version; in real project you will probably need to expose ports etc.
38+
39+
## Overriding CMD
40+
41+
By default (i.e. if you don't provide CMD in your `docker run` or `docker-compose.yml`) it will run sbt's `shell`. It's a reasonable default because from there you can invoke any SBT task you want.
42+
43+
If default does not fit your needs then override CMD in either `docker run` or `docker-compose.yml`. Example:
44+
45+
```
46+
docker run -v :.:/toolkit proteinevolution/toolkit-docker:latest projects test:compile
47+
```
48+
49+
Here we also used ability to "chain" sbt commands.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# The only point of that entrypoint file is to merge `ivy2_image/local` (where sbt libraries built in Dockerfile reside)
3+
# The only point of that entrypoint file is to merge `ivy2_image/local` (where sbt libraries built in Dockerfile.backend reside)
44
# into `/root/.ivy2/local`. `.ivy2/local` is where image user could mount his host ivy cache
55
# IMPORTANT: always use LF line endings for this file
66

frontend/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:10.16
2+
3+
LABEL maintainer="fgabler@tue.mpg.de"
4+
5+
RUN yarn global add yarn@1.16.0
6+
RUN yarn global add @vue/cli npm-check-updates
7+
8+
ENV CHOKIDAR_USEPOLLING=true
9+
10+
VOLUME /toolkit/frontend
11+
WORKDIR /toolkit/frontend
12+
13+
# expose frontend port
14+
ENV PORT=8080
15+
EXPOSE 8080
16+
17+
CMD yarn install

frontend/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Toolkit Frontend Docker Image
2+
Dockerfile for the toolkit's frontend docker image. It should be built automatically by DockerCloud.
3+
4+
To build it manually, run:
5+
``docker image build -t "proteinevolution/toolkit-docker-frontend:1.0.0" -t "proteinevolution/toolkit-docker-frontend:latest" .``
6+
7+
To push the image, run:
8+
``docker push proteinevolution/toolkit-docker-frontend:latest``
9+
10+
## Various commands
11+
To access the shell, run:
12+
``docker run --name tk-frontend -p 8080:8080/tcp -v "$PWD:/toolkit" --rm -it proteinevolution/toolkit-docker-frontend bash``
13+

0 commit comments

Comments
 (0)