Skip to content

Commit

Permalink
Merge pull request #68 from Kong/docker
Browse files Browse the repository at this point in the history
Use non-root user
  • Loading branch information
voigtjr authored Jan 8, 2025
2 parents 372a20c + 4b8cb14 commit 0127fb1
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:jammy-20240808
FROM ubuntu:jammy

LABEL name="httpbin"
LABEL description="A simple HTTP service."
Expand All @@ -9,11 +9,30 @@ ENV HOME=/httpbin

WORKDIR /httpbin

RUN apt update -y && apt install python3-pip libssl-dev libffi-dev git -y && pip3 install --no-cache-dir pipenv
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
httpbin

RUN chown httpbin /httpbin
RUN chmod u+rwx /httpbin

RUN apt-get update -y && apt-get install python3-pip libssl-dev libffi-dev git libcap2-bin -y

ADD . .
RUN pipenv sync

RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/python3.10
EXPOSE 80

USER httpbin
ENV PATH="/httpbin/.local/bin:$PATH"

RUN pip3 install --no-cache-dir pipenv
RUN pipenv sync

CMD ["pipenv", "run", "gunicorn", "-b", "0.0.0.0:80", "httpbin:app", "-k", "gevent"]

0 comments on commit 0127fb1

Please sign in to comment.