Run as non-root local user

This commit is contained in:
Andras Fekete
2022-12-15 12:10:25 -05:00
parent be1b3ec007
commit c1ad3457f3
2 changed files with 8 additions and 1 deletions

View File

@@ -1,3 +1,10 @@
FROM ubuntu:22.04 FROM ubuntu:22.04
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y build-essential autoconf libtool RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y build-essential autoconf libtool
ARG USER=docker
ARG UID=1000
ARG GID=1000
RUN groupadd -g ${GID} docker && useradd -ms /bin/bash ${USER} -u ${UID} -g ${GID}
USER ${UID}:${GID}

View File

@@ -1,5 +1,5 @@
echo "Running with \"${@}\"..." echo "Running with \"${@}\"..."
docker build -t wolfssl . && \ docker build -t wolfssl --build-arg UID=$(id -u) --build-arg GID=$(id -g) . && \
docker run -it -v $(pwd)/..:/tmp/wolfssl -w /tmp/wolfssl wolfssl /bin/bash -c "./autogen.sh && ./configure $(echo ${@}) && make && ./testsuite/testsuite.test" && \ docker run -it -v $(pwd)/..:/tmp/wolfssl -w /tmp/wolfssl wolfssl /bin/bash -c "./autogen.sh && ./configure $(echo ${@}) && make && ./testsuite/testsuite.test" && \
docker run -it -v $(pwd)/..:/tmp/wolfssl -w /tmp/wolfssl wolfssl /bin/bash docker run -it -v $(pwd)/..:/tmp/wolfssl -w /tmp/wolfssl wolfssl /bin/bash
echo "Exited with error code $?" echo "Exited with error code $?"