summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorJonas Zohren <git-pbkyr@jzohren.de>2022-02-16 15:04:32 +0100
committerJonas Zohren <git-pbkyr@jzohren.de>2022-02-16 15:13:04 +0100
commitb4225cb0fca88636e0a4d6213cfcea30c800ec1e (patch)
treeeccb5abb5b0ab309b3f11fc978a52e4041aab0f7 /Dockerfile
parent98b67da649c602574b4c4b304b3c52fdd0450641 (diff)
downloadconduit-b4225cb0fca88636e0a4d6213cfcea30c800ec1e.zip
fix(docker): use user 1000 and standard db path
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile15
1 files changed, 8 insertions, 7 deletions
diff --git a/Dockerfile b/Dockerfile
index 49c3224..76d10ea 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,7 +3,8 @@ FROM docker.io/rust:1.58-bullseye AS builder
WORKDIR /usr/src/conduit
# Install required packages to build Conduit and it's dependencies
-RUN apt update && apt -y install libclang-dev
+RUN apt-get update && \
+ apt-get -y --no-install-recommends install libclang-dev=1:11.0-51+nmu5
# == Build dependencies without our own code separately for caching ==
#
@@ -44,7 +45,7 @@ ENV CONDUIT_PORT=6167 \
# Conduit needs:
# ca-certificates: for https
# iproute2 & wget: for the healthcheck script
-RUN apt update && apt -y install \
+RUN apt-get update && apt-get -y --no-install-recommends install \
ca-certificates \
iproute2 \
wget \
@@ -61,12 +62,12 @@ HEALTHCHECK --start-period=5s --interval=5s CMD ./healthcheck.sh
COPY --from=builder /usr/src/conduit/target/release/conduit /srv/conduit/conduit
# Improve security: Don't run stuff as root, that does not need to run as root
-# Add 'conduit' user and group (100:82). The UID:GID choice is to be compatible
-# with previous, Alpine-based containers, where the user and group were both
-# named 'www-data'.
+# Most distros also use 1000:1000 for the first real user, so this should resolve volume mounting problems.
+ARG USER_ID=1000
+ARG GROUP_ID=1000
RUN set -x ; \
- groupadd -r -g 82 conduit ; \
- useradd -r -M -d /srv/conduit -o -u 100 -g conduit conduit && exit 0 ; exit 1
+ groupadd -r -g ${GROUP_ID} conduit ; \
+ useradd -l -r -M -d /srv/conduit -o -u ${USER_ID} -g conduit conduit && exit 0 ; exit 1
# Change ownership of Conduit files to conduit user and group and make the healthcheck executable:
RUN chown -cR conduit:conduit /srv/conduit && \