Skip to content

Commit 5e9a27d

Browse files
Merge pull request #242 from developmentseed/non-root-container
Add non-root user for container.
2 parents 7eb3065 + 0c09912 commit 5e9a27d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Note: Minor version `0.X.0` update might break the API, It's recommended to pin
99
## [unreleased]
1010

1111
* switch to official python docker image from `bitnami`
12+
* changed container image to use non-root `user`
1213

1314
## [1.2.1] - 2025-08-26
1415

dockerfiles/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@ COPY pyproject.toml pyproject.toml
2424
RUN python -m pip install . --no-cache-dir
2525
RUN rm -rf tipg/ README.md pyproject.toml LICENSE
2626

27+
RUN groupadd -g 1000 user && \
28+
useradd -u 1000 -g user -s /bin/bash -m user
29+
30+
USER user
31+
2732
###################################################
2833
# For compatibility (might be removed at one point)
2934
ENV MODULE_NAME=tipg.main
3035
ENV VARIABLE_NAME=app
3136
ENV HOST=0.0.0.0
3237
ENV PORT=80
3338
ENV WEB_CONCURRENCY=1
39+
3440
CMD gunicorn -k uvicorn.workers.UvicornWorker ${MODULE_NAME}:${VARIABLE_NAME} --bind ${HOST}:${PORT} --workers ${WEB_CONCURRENCY}

0 commit comments

Comments
 (0)