From 623e9c50d2c7feb95e8fb85956b52b20e16aa7c8 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Wed, 24 Jul 2019 18:05:11 +0200 Subject: [PATCH] Fix creation of dummy user --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 77d25ab..857925a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,5 @@ FROM ekidd/rust-musl-builder:stable as builder -# RUN adduser -D hoc -RUN useradd -u 10001 dummy - # create new cargo project RUN USER=rust cargo init --bin # copy build config @@ -17,9 +14,14 @@ COPY ./src ./src # build source code RUN cargo build --release + +# create /etc/password for rootless scratch container +FROM alpine:latest as user_builder +RUN USER=root adduser -D -u 10001 dummy + FROM scratch -COPY --from=builder /etc/passwd /etc/passwd +COPY --from=user_builder /etc/passwd /etc/passwd USER dummy COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/gitache /