From f943406be30a683093f73f74697bfe89daa76159 Mon Sep 17 00:00:00 2001 From: KartoffelCheetah Date: Fri, 11 Dec 2020 16:02:35 +0100 Subject: [PATCH] Adds predefined node user to docker-compose * Runs commands with node user (1000:1000) instead of root by default. [1] * Adds `npm install` line below the `docker-compose up` in the README.md. [1] https://github.com/nodejs/docker-node/blob/c2604466d06ba562fd9040d18c57af16545c6a5b/10/stretch/Dockerfile#L3 --- README.md | 4 ++++ docker-compose.yml | 1 + 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index bc6e2926..72c8dda9 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,10 @@ For that, you need Docker with docker-compose in your machine. Once you've everything running, you can simply run the following command to start the dev server: +```bash +docker-compose run --user 1000:1000 app npm install +``` + ```bash docker-compose up -d ``` diff --git a/docker-compose.yml b/docker-compose.yml index 39201b09..55014247 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ version: '2' services: app: + user: node image: node:10.13.0 command: npm run serve working_dir: /app