changeset 596:6d7c0dbf9d21

Fix running client container with clean checkout in volume The vue CLI Service needs to be installed locally into the project in order to be able to run 'yarn serve'. Use make for dependency installation because the makefile will get updated whenever the process changes. In passing: docs and more robust sources.list adaptation
author Tom Gottfried <tom@intevation.de>
date Fri, 07 Sep 2018 14:43:15 +0200
parents 6c3527ddc200
children 3704ce844530
files docker/Dockerfile.spa docker/README.md
diffstat 2 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/docker/Dockerfile.spa	Fri Sep 07 14:35:18 2018 +0200
+++ b/docker/Dockerfile.spa	Fri Sep 07 14:43:15 2018 +0200
@@ -1,10 +1,10 @@
 FROM ubuntu:bionic
 LABEL authors="tom@intevation.de"
 
-RUN sed -i 's/$/ universe/' /etc/apt/sources.list
+RUN sed -i 's/\(deb.*\)$/\1 universe/' /etc/apt/sources.list
 
 RUN apt-get update &&\
-    apt-get -y install --no-install-recommends curl nodejs
+    apt-get -y install --no-install-recommends curl nodejs make
 
 # Install yarn
 RUN curl https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - &&\
@@ -17,8 +17,6 @@
 
 WORKDIR /opt/gemma_spa
 
-RUN yarn install
-
 EXPOSE 8080
 
-CMD ["yarn", "serve"]
+CMD make -f Makefile.build dependencies && yarn serve
--- a/docker/README.md	Fri Sep 07 14:35:18 2018 +0200
+++ b/docker/README.md	Fri Sep 07 14:43:15 2018 +0200
@@ -81,3 +81,19 @@
   ```
   Use `--network-alias gemma_backend` if you give your container
   a different name.
+
+## SPA setup
+
+- Build Dockerfile with e.g.:
+  ```
+  docker build -t gemma_spa -f docker/Dockerfile.spa .
+  ```
+
+- Get a running instance with e.g.:
+  ```
+  docker run --name gemma_spa -v $PWD/client:/opt/gemma_spa -d -p 8290:8080 \
+             --network gemma gemma_spa
+  ```
+
+Now you should be able to use the application in your browser by going to
+`http://HOST:8290`, with HOST being the hostname of your docker host.