Skip to content

Commit

Permalink
fix: write permission issue for uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
ashraful-islam committed Jun 9, 2018
1 parent d7276e4 commit f1d4f98
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml.example
Expand Up @@ -12,6 +12,7 @@ services:
- DB_HOST=dropit_database
- NODE_ENV
env_file: .env
restart: always
ports:
- 7000:7000
depends_on:
Expand All @@ -21,6 +22,7 @@ services:
dropit_database:
image: mongo:3.4-jessie
env_file: ./.env
restart: always
ports:
- 27017:27017
volumes:
Expand Down
19 changes: 12 additions & 7 deletions dockerfiles/dockerfile_dropitapp
Expand Up @@ -14,21 +14,26 @@ ENV DATABASEURL mongodb://$MONGO_USERNAME:$MONGO_PASSWORD@$DB_HOST/$MONGO_DATABA
ENV NODE_ENV ${NODE_ENV}

# create required directory structure, add user & set permissions
RUN mkdir -p /var/app \
RUN mkdir -p /var/app /var/app/files \
&& addgroup -S dropitapp \
&& adduser -D -S dropitapp -G dropitapp \
&& chown dropitapp:dropitapp /var/app

# copy app contents
COPY . /var/app
&& adduser -D -S dropitapp -G dropitapp

# set working directory to app folder
WORKDIR /var/app

# copy app contents
COPY package.json /var/app

# install packages and remove cache
RUN npm install && npm cache clean -f

# switch to guest user
# copy rest of the files
ADD . /var/app

# give permission
RUN chown -R dropitapp:dropitapp /var/app && chmod g+rw /var/app && chmod g-x /var/app/files

# switch user
USER dropitapp

# boot app
Expand Down

0 comments on commit f1d4f98

Please sign in to comment.