Skip to content

Commit

Permalink
Run containers as non-root
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Feb 22, 2023
1 parent f4b2d6b commit 98d0568
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@ VOLUME /pcw/db

EXPOSE 8000/tcp

RUN useradd --no-create-home --uid 1777 --user-group --shell /bin/false pcw && chown -R pcw:pcw /pcw
USER pcw

# Once we are certain that this runs nicely, replace this with ENTRYPOINT.
CMD ["/pcw/container-startup", "run"]
3 changes: 3 additions & 0 deletions Dockerfile_dev
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ RUN zypper -n in python310-devel gcc libffi-devel aws-cli && pip install --no-ca

WORKDIR /pcw

RUN useradd --no-create-home --uid 1777 --user-group --shell /bin/false pcw && chown -R pcw:pcw /pcw
USER pcw

ENTRYPOINT ["sh", "-c"]
4 changes: 4 additions & 0 deletions Dockerfile_k8s
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ COPY cleanup_k8s.py LICENSE README.md setup.cfg /pcw/
ENV PATH ${PATH}:/opt/google-cloud-sdk/bin/

WORKDIR /pcw

RUN useradd --no-create-home --uid 1777 --user-group --shell /bin/false pcw && chown -R pcw:pcw /pcw
USER pcw

CMD ["python3", "cleanup_k8s.py"]
3 changes: 3 additions & 0 deletions Dockerfile_k8s_dev
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ ENV PATH ${PATH}:/opt/google-cloud-sdk/bin/

WORKDIR /pcw

RUN useradd --no-create-home --uid 1777 --user-group --shell /bin/false pcw && chown -R pcw:pcw /pcw
USER pcw

ENTRYPOINT ["sh", "-c"]

0 comments on commit 98d0568

Please sign in to comment.