Skip to content

Add non-root user for running uwsgi in Dockerfile #388

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

Merged
merged 14 commits into from
Oct 9, 2020
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /usr/local/bin/cc-test-reporter
chmod +x /usr/local/bin/cc-test-reporter
/usr/local/bin/cc-test-reporter before-build
- run: sudo chown -R 5000 .
- run:
name: Run tests
command: |
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ RUN poetry install --no-dev --no-interaction --no-ansi

COPY . /src

RUN useradd --no-create-home --system -s /bin/false --uid 5000 uwsgi

RUN chown -R uwsgi /src

EXPOSE 5000

USER uwsgi

CMD [ "uwsgi", "--ini", "app.ini" ]
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
addopts = -p no:warnings
addopts = -p no:warnings