mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 18:56:15 +02:00
node container permissions fixes
This commit is contained in:
parent
28b964cc47
commit
9cbd6d0223
3 changed files with 20 additions and 3 deletions
|
@ -85,6 +85,7 @@ services:
|
|||
volumes:
|
||||
- .:/app
|
||||
working_dir: /app
|
||||
entrypoint: /app/node_entrypoint.sh
|
||||
stdin_open: true
|
||||
tty: true
|
||||
command: ./run_node_watch.sh
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
FROM docker.io/cimg/node:current-browsers
|
||||
WORKDIR /app
|
||||
|
||||
# Install gosu
|
||||
USER root
|
||||
RUN apt-get update && \
|
||||
apt-get install -y gosu && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install app dependencies
|
||||
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
||||
# where available (npm@5+)
|
||||
COPY --chown=circleci:circleci package*.json ./
|
||||
|
||||
RUN npm install
|
12
src/node_entrypoint.sh
Executable file
12
src/node_entrypoint.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Get UID and GID of the /app directory owner
|
||||
HOST_UID=$(stat -c '%u' /app)
|
||||
HOST_GID=$(stat -c '%g' /app)
|
||||
|
||||
# Update circleci user's UID and GID to match the host
|
||||
echo "Updating circleci user and group to match host UID:GID ($HOST_UID:$HOST_GID)"
|
||||
sudo groupmod -g "$HOST_GID" circleci
|
||||
sudo usermod -u "$HOST_UID" circleci
|
||||
|
||||
exec gosu circleci "$@"
|
Loading…
Add table
Add a link
Reference in a new issue