From 7f31dd671ad65119a58c87d04f05bc755397302c Mon Sep 17 00:00:00 2001 From: Marco Ferragina Date: Tue, 7 Feb 2023 09:32:20 +0100 Subject: [PATCH] improved dockerfile --- hack/docker/Dockerfile | 26 +++++++++++++++++++++++--- hack/docker/entrypoint.sh | 4 ++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100755 hack/docker/entrypoint.sh diff --git a/hack/docker/Dockerfile b/hack/docker/Dockerfile index 686b4dde..1cb1f53e 100644 --- a/hack/docker/Dockerfile +++ b/hack/docker/Dockerfile @@ -17,9 +17,29 @@ RUN go build \ # Final docker image FROM ubuntu:latest -RUN apt update && \ - apt install -y ca-certificates && \ +RUN set -eux; \ + apt update && \ + apt install -y \ + ca-certificates \ + sudo \ + git \ + vim \ + byobu \ + psmisc \ + iputils-ping \ + netcat \ + dnsutils \ + bash-completion \ + && \ apt clean +RUN \ + sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashrc \ + && adduser --gecos "" --disabled-password rospo \ + && echo "rospo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ + && addgroup rospo sudo + COPY --from=gobuilder /rospo /usr/local/bin/rospo -ENTRYPOINT ["rospo"] \ No newline at end of file + +COPY ./hack/docker/entrypoint.sh / +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/hack/docker/entrypoint.sh b/hack/docker/entrypoint.sh new file mode 100755 index 00000000..0d9a8d12 --- /dev/null +++ b/hack/docker/entrypoint.sh @@ -0,0 +1,4 @@ +#! /bin/sh + +cd /home/rospo +sudo -u rospo rospo "$@" \ No newline at end of file