annotate Dockerfile @ 318:1a2dfd9351e9

Add example configuration and use it in dockerised backend Besides the documenting effect of an example, using it in a docker container makes it easier to change configuration via a volume of the running container.
author Tom Gottfried <tom@intevation.de>
date Thu, 02 Aug 2018 12:48:59 +0200
parents 0d2bdec1e637
children 6d145ee0a097
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
308
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
1 FROM ubuntu:bionic
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
2 LABEL authors="tom.gottfried@intevation.de"
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
3
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
4 RUN sed -i 's/$/ universe/' /etc/apt/sources.list
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
5
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
6 RUN apt-get update &&\
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
7 apt-get -y install --no-install-recommends \
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
8 make git golang-go golang-github-gorilla-context-dev
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
9
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
10 WORKDIR /opt/gemma
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
12 # Copy only backend stuff
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
13 COPY 3rdpartylibs.sh ./
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14 COPY auth ./auth/
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15 COPY cmd ./cmd/
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16 COPY config ./config/
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 COPY controllers ./controllers/
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
18 COPY Makefile ./
318
1a2dfd9351e9 Add example configuration and use it in dockerised backend
Tom Gottfried <tom@intevation.de>
parents: 309
diff changeset
19 COPY example_conf.toml ./
308
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
20
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
21 RUN make gemma && mkdir /opt/bin && mv cmd/gemma/gemma /opt/bin/
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
22
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
23 EXPOSE 8000
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
24
318
1a2dfd9351e9 Add example configuration and use it in dockerised backend
Tom Gottfried <tom@intevation.de>
parents: 309
diff changeset
25 CMD ["/opt/bin/gemma", "-c", "/opt/gemma/example_conf.toml"]
308
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
26
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
27 # Run with e.g.
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
28 # docker build -t gemma_backend .
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
29 # docker run --name gemma_backend -v $PWD:/opt/gemma -d -p 8200:8000 \
e964c617265e Add Dockerfile for gemma backend
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
30 # --link your_gemma_db:gemma_db gemma_backend
309
0d2bdec1e637 Hint how to rebuild gemma inside Docker container
Tom Gottfried <tom@intevation.de>
parents: 308
diff changeset
31 #
0d2bdec1e637 Hint how to rebuild gemma inside Docker container
Tom Gottfried <tom@intevation.de>
parents: 308
diff changeset
32 # To rebuild inside the container:
0d2bdec1e637 Hint how to rebuild gemma inside Docker container
Tom Gottfried <tom@intevation.de>
parents: 308
diff changeset
33 # ln -sf /opt/gemma/cmd/gemma/gemma /opt/bin/gemma
0d2bdec1e637 Hint how to rebuild gemma inside Docker container
Tom Gottfried <tom@intevation.de>
parents: 308
diff changeset
34 # make gemma