mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
docker: allow configuring UID/GID used inside the containers
This commit is contained in:
parent
ad1f5b8fde
commit
22d0b14ef1
3 changed files with 35 additions and 8 deletions
|
@ -21,6 +21,11 @@ API_PORT=3000
|
||||||
# Only required if relevant feature is used
|
# Only required if relevant feature is used
|
||||||
#PHISHERMAN_API_KEY=
|
#PHISHERMAN_API_KEY=
|
||||||
|
|
||||||
|
# The user ID and group ID that should be used within the Docker containers
|
||||||
|
# This should match your own user ID and group ID. Run `id -u` and `id -g` to find them.
|
||||||
|
DOCKER_USER_UID=
|
||||||
|
DOCKER_USER_GID=
|
||||||
|
|
||||||
#
|
#
|
||||||
# DOCKER (DEVELOPMENT)
|
# DOCKER (DEVELOPMENT)
|
||||||
#
|
#
|
||||||
|
|
|
@ -26,39 +26,51 @@ services:
|
||||||
command: --authentication-policy=mysql_native_password
|
command: --authentication-policy=mysql_native_password
|
||||||
|
|
||||||
prepare_backend:
|
prepare_backend:
|
||||||
image: node:16.16
|
build:
|
||||||
|
context: ./docker/production/node
|
||||||
|
args:
|
||||||
|
DOCKER_USER_UID: ${DOCKER_USER_UID:?Missing DOCKER_USER_UID}
|
||||||
|
DOCKER_USER_GID: ${DOCKER_USER_GID:?Missing DOCKER_USER_GID}
|
||||||
depends_on:
|
depends_on:
|
||||||
- mysql
|
- mysql
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/zeppelin
|
- ./:/zeppelin
|
||||||
user: node
|
|
||||||
command: |-
|
command: |-
|
||||||
bash -c "cd /zeppelin/backend && npm ci && npm run build && npm run migrate-prod"
|
bash -c "cd /zeppelin/backend && npm ci && npm run build && npm run migrate-prod"
|
||||||
|
|
||||||
api:
|
api:
|
||||||
image: node:16.16
|
build:
|
||||||
|
context: ./docker/production/node
|
||||||
|
args:
|
||||||
|
DOCKER_USER_UID: ${DOCKER_USER_UID:?Missing DOCKER_USER_UID}
|
||||||
|
DOCKER_USER_GID: ${DOCKER_USER_GID:?Missing DOCKER_USER_GID}
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
- prepare_backend
|
- prepare_backend
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/zeppelin
|
- ./:/zeppelin
|
||||||
user: node
|
|
||||||
command: ["/bin/bash", "/zeppelin/docker/production/start-api.sh"]
|
command: ["/bin/bash", "/zeppelin/docker/production/start-api.sh"]
|
||||||
|
|
||||||
bot:
|
bot:
|
||||||
image: node:16.16
|
build:
|
||||||
|
context: ./docker/production/node
|
||||||
|
args:
|
||||||
|
DOCKER_USER_UID: ${DOCKER_USER_UID:?Missing DOCKER_USER_UID}
|
||||||
|
DOCKER_USER_GID: ${DOCKER_USER_GID:?Missing DOCKER_USER_GID}
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
- prepare_backend
|
- prepare_backend
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/zeppelin
|
- ./:/zeppelin
|
||||||
user: node
|
|
||||||
command: ["/bin/bash", "/zeppelin/docker/production/start-bot.sh"]
|
command: ["/bin/bash", "/zeppelin/docker/production/start-bot.sh"]
|
||||||
|
|
||||||
build_dashboard:
|
build_dashboard:
|
||||||
image: node:16.16
|
build:
|
||||||
|
context: ./docker/production/node
|
||||||
|
args:
|
||||||
|
DOCKER_USER_UID: ${DOCKER_USER_UID:?Missing DOCKER_USER_UID}
|
||||||
|
DOCKER_USER_GID: ${DOCKER_USER_GID:?Missing DOCKER_USER_GID}
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/zeppelin
|
- ./:/zeppelin
|
||||||
user: node
|
|
||||||
command: |-
|
command: |-
|
||||||
bash -c "cd /zeppelin/dashboard && npm ci && npm run build"
|
bash -c "cd /zeppelin/dashboard && npm ci && npm run build"
|
||||||
|
|
10
docker/production/node/Dockerfile
Normal file
10
docker/production/node/Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
FROM node:16.16
|
||||||
|
|
||||||
|
ARG DOCKER_USER_UID
|
||||||
|
ARG DOCKER_USER_GID
|
||||||
|
|
||||||
|
# This custom Dockerfile is needed for the Node image so we can change the uid/gid used for the node user
|
||||||
|
# See https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
|
||||||
|
RUN groupmod -g "${DOCKER_USER_GID}" node && usermod -u "${DOCKER_USER_UID}" -g "${DOCKER_USER_GID}" node
|
||||||
|
|
||||||
|
USER node
|
Loading…
Add table
Reference in a new issue