Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Project Files Permission #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- YARN=false
volumes:
- ../:/opt/app
entrypoint: run-nodock "node index.js"
entrypoint: run-nodock "sleep infinity"
tty: true

mysql:
Expand Down
4 changes: 3 additions & 1 deletion node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ RUN if [ ${YARN} = true ]; then \

COPY scripts/run-nodock.sh /usr/bin/run-nodock

RUN chmod 700 /usr/bin/run-nodock
RUN chmod 777 /usr/bin/run-nodock

USER www-app

WORKDIR /opt/app
21 changes: 20 additions & 1 deletion workspace/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apt-get update && \
iputils-ping && \
npm install -g n


##
## Timezone
##
Expand All @@ -33,7 +34,25 @@ RUN npm i -g yarn

COPY ./crontab /var/spool/cron/crontabs

USER root

WORKDIR /opt/app

RUN chmod -R 777 /opt/app

# Add a non-root user to prevent files being created with root permissions on host machine.
ARG PUID=1000
ENV PUID ${PUID}
ARG PGID=1000
ENV PGID ${PGID}

# always run apt update when start and after add new source list, then clean up at end.
RUN groupadd -g ${PGID} nodock && \
useradd -u ${PUID} -g nodock -m nodock -G doker_env && \
usermod -p "*" nodock

RUN chown -R nodock:nodock /opt/app

USER nodock

ENTRYPOINT sleep infinity
ENTRYPOINT sleep infinity