aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Plsek <jeremyplsek@gmail.com>2019-12-17 15:13:00 -0500
committerJeremy Plsek <jeremyplsek@gmail.com>2019-12-17 15:13:00 -0500
commitedf4d6729b94258f8b404684703984b724c45c8f (patch)
treedc02d3a7151cbb15fc8bed0f410aa3346b81b9ee
parent6be40a5f2d75b157cf2a2374f2f866f6fdc92b18 (diff)
devel: use mounts for development
This removes the need to rebuild the containers every time for simple changes during development. This does not include python dependencies since those are installed globally in the container. (I would have done the same for JS dependencies, but it's used in the static files.) Removed the background flag for running in dev mode when using make. It's easier to kill the servers (^C) and view logs of the server without needing to call separate commands later. Nginx is disabled in dev mode since the server and static files are handled by Django instead. Update readme to reflect upon changes made. Signed-off-by: Jeremy Plsek <jeremyplsek@gmail.com> Change-Id: I7888ca89021fca313e1043a7f94b5e1b7e12498c
-rw-r--r--Makefile2
-rw-r--r--docker-compose.override-dev.yml13
-rw-r--r--readme.txt5
-rw-r--r--web/Dockerfile13
4 files changed, 24 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 0342381..eccb215 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ build:
docker-compose -f docker-compose.yml -f docker-compose.override-dev.yml build
dev-up:
- docker-compose -f docker-compose.yml -f docker-compose.override-dev.yml up -d
+ docker-compose -f docker-compose.yml -f docker-compose.override-dev.yml up
dev-start:
docker-compose -f docker-compose.yml -f docker-compose.override-dev.yml start
diff --git a/docker-compose.override-dev.yml b/docker-compose.override-dev.yml
index b9de639..c6ee3b8 100644
--- a/docker-compose.override-dev.yml
+++ b/docker-compose.override-dev.yml
@@ -9,11 +9,24 @@
##############################################################################
version: '3'
services:
+ nginx:
+ command: echo "Nginx is disabled in dev mode."
+ restart: "no"
+
web:
image: opnfv/laas-dashboard:dev
build:
context: .
dockerfile: web/Dockerfile
+ command: >
+ sh -c "cd static && bower install --allow-root && cd .. &&
+ ./manage.py migrate &&
+ ./manage.py runserver 0:8000"
+ volumes:
+ - ./src:/laas_dashboard
+ ports:
+ - "8000:8000"
+
worker:
image: opnfv/laas-celery:dev
build:
diff --git a/readme.txt b/readme.txt
index fad9e71..6f48812 100644
--- a/readme.txt
+++ b/readme.txt
@@ -19,7 +19,10 @@ Deployment:
- complete the config.env.sample file and save it as config.env
- install docker, docker-compose
- run 'make data'
-- run 'make up' to run the dashboard
+- run 'make up' to run the dashboard (or 'make dev-up' for development)
+
+Production will be running on port 80 by default.
+Development will be running on port 8000 by default.
Updating:
diff --git a/web/Dockerfile b/web/Dockerfile
index bdb9b41..fe525ca 100644
--- a/web/Dockerfile
+++ b/web/Dockerfile
@@ -6,21 +6,20 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-FROM node as static
-RUN npm install -g bower
-ADD src/static/ /static
-WORKDIR /static/
-RUN bower install --allow-root
-
FROM python:3.5
ENV PYTHONUNBUFFERED 1
+RUN apt-get update && apt-get install -y npm
+RUN npm install -g bower
+
ADD requirements.txt /requirements.txt
RUN pip install -r /requirements.txt
ADD web/init.sh /init.sh
ADD src/ /laas_dashboard/
-COPY --from=static /static/ laas_dashboard/static/
+
+ADD src/static/ laas_dashboard/static/
+RUN cd laas_dashboard/static/ && bower install --allow-root
WORKDIR /laas_dashboard/
CMD ["/init.sh"]