Skip to content

Commit 36fe080

Browse files
Adding non root user
1 parent aa0f91b commit 36fe080

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@ ENV PYTHONPATH /app
33
ENV PYTHONUNBUFFERED 1
44
ENV PYTHONDONTWRITEBYTECODE 1
55

6+
RUN groupadd --gid 5000 main \
7+
&& useradd --home-dir /home/main --create-home --uid 5000 \
8+
--gid 5000 --shell /bin/sh --skel /dev/null main
9+
610
COPY . /app
711
WORKDIR /app
812

913
# install curl; skipcq: DOK-DL3008
10-
RUN apt-get update && apt-get install -y curl git && apt-get clean && rm -rf /var/lib/apt/lists/*
14+
RUN apt-get update && apt-get install --no-install-recommends -y curl git && apt-get clean && rm -rf /var/lib/apt/lists/*
1115
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
1216

1317
# download the DeepSource CLI binary
1418
RUN curl https://deepsource.io/cli | bash
1519
RUN ["chmod", "777", "/app/main.py"]
1620

21+
USER main
22+
1723
CMD ["/app/main.py"]

0 commit comments

Comments
 (0)