From 9adc9bc6373e24f7040900da373469cd5e5a8801 Mon Sep 17 00:00:00 2001 From: Augusto Herrmann Date: Mon, 20 Sep 2021 02:42:12 -0300 Subject: [PATCH] add parameter to build docker container in development mode --- Dockerfile | 8 +++++--- README.md | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 93cc85f16..93c54311a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,20 @@ # DESCRIPTION: publicbodies.org website # BUILD: docker build --rm -t publicbodies . # -# If you want to just build the documentation portal locally, do: -# docker build --rm -t publicbodies . +# If you want to build the portal locally in development mode, do: +# docker build --rm -t publicbodies . --build-arg NODE_ENV=development # to build the container, then run # docker run --rm --name publicbodies -p 3000:3000 -it publicbodies node index.js # open http://localhost:3000 on your browser to see the portal. FROM node:12 +ARG NODE_ENV=production + # Never prompt the user for choices on installation/configuration of packages ENV DEBIAN_FRONTEND noninteractive ENV TERM linux -ENV NODE_ENV=production +ENV NODE_ENV=$NODE_ENV # from https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#global-npm-dependencies ENV NPM_CONFIG_PREFIX=/home/node/.npm-global ENV PATH=$PATH:/home/node/.npm-global/bin diff --git a/README.md b/README.md index 4f50ad021..af5bd7c82 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,13 @@ The website is a node webapp. To get it running: ``` docker build --rm -t publicbodies . ``` + + If you are building a development environment, please use: + + ``` + docker build --rm -t publicbodies . --build-arg NODE_ENV=development + ``` + so that you can get debugging information. 4. Run the webapp: