Skip to content

Commit 169501b

Browse files
committed
chore: Run pushpin as non-privledged user
Previously the docker container ran pushpin by default as root, which is against recommended security standards. This should create a new pushpin group and user and run pushpin under those. Closes #25
1 parent 87eb793 commit 169501b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ COPY --from=build /build/out/ /
4141
# Add entrypoint script
4242
COPY docker-entrypoint.sh /usr/local/bin/
4343

44+
# Create a non-root user, group, directories and switch to that user.
45+
RUN groupadd -r -g 1001 pushpin && \
46+
useradd -r -u 1001 -g pushpin pushpin
47+
48+
RUN mkdir -p /var/run/pushpin && \
49+
chown -R pushpin:pushpin /etc/pushpin /var/run/pushpin
50+
51+
# Using the user_id specifically here allows for less configuration in k8s
52+
USER 1001
53+
4454
ENV LANG C.UTF-8
4555

4656
# Define default entrypoint and command

0 commit comments

Comments
 (0)