Skip to content

Commit

Permalink
non-root user
Browse files Browse the repository at this point in the history
  • Loading branch information
liisaratsep committed Sep 13, 2021
1 parent 8e68be4 commit 81b365b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ RUN apk update \
musl-dev \
git

WORKDIR /var/log/app
WORKDIR /app
RUN adduser -D app; chown -R app:app /app

COPY requirements/requirements.txt .
RUN pip install -r requirements.txt && rm requirements.txt
USER app
ENV PATH="/home/app/.local/bin:${PATH}"

COPY . .
COPY --chown=app:app requirements/requirements.txt .
RUN pip install --user -r requirements.txt && rm requirements.txt

COPY --chown=app:app . .

EXPOSE 5000

Expand Down
2 changes: 1 addition & 1 deletion config/logging.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ args = (sys.stdout, )
[handler_file]
class = handlers.RotatingFileHandler
formatter = simple
args = ('/var/log/app/nmt_api.log', 'a', 10000000, 15)
args = ('/app//logs/nmt_api.log', 'a', 10000000, 15)

[formatter_simple]
format = [%(asctime)s] [%(levelname)s] [%(name)s]: %(message)s
4 changes: 4 additions & 0 deletions logs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

0 comments on commit 81b365b

Please sign in to comment.