From 92c7d8d3e7d8cdc04f3c63e770b3b06ede7a4ec1 Mon Sep 17 00:00:00 2001
From: Mandar Harshe <mandarharshe@gmail.com>
Date: Sun, 7 Nov 2021 17:14:10 +0100
Subject: [PATCH] Update dockerfile to 20.04 and use default user

While building the docker image pass the arguments `--build-arg
"host_uid=$(id -u)" --build-arg "host_gid=$(id -g)"` so that you can
use the outputs of the compilation outside

Update Docker ubuntu version and add Cython
---
 Dockerfile | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index a7adbc4..c2662af 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:18.04
+FROM ubuntu:20.04
 ENV SRC /home/tester/src
 ENV DEBIAN_FRONTEND noninteractive
 
@@ -10,7 +10,7 @@ RUN apt-get update -y && apt-get install -qy \
         python3 \
         python-dev \
         python3-dev \
-        python-pip \
+        python3-pip \
         librocksdb-dev \
         libsnappy-dev \
         zlib1g-dev \
@@ -24,10 +24,19 @@ RUN update-locale
 RUN locale-gen $LANG
 
 #NOTE(sileht): Upgrade python dev tools
-RUN pip install -U pip tox virtualenv
+RUN pip3 install -U pip tox virtualenv setuptools pytest Cython
 
-RUN groupadd --gid 2000 tester
-RUN useradd --uid 2000 --gid 2000 --create-home --shell /bin/bash tester
-USER tester
+# Set username same as generic default username. Allows output build to be available to same user
+ENV USER_NAME ubuntu
 
-WORKDIR $SRC
+ARG host_uid=1001
+ARG host_gid=1001
+RUN groupadd -g $host_gid $USER_NAME && \
+    useradd -g $host_gid -m -s /bin/bash -u $host_uid $USER_NAME
+
+USER $USER_NAME
+
+ENV BUILD_INPUT_DIR /home/$USER_NAME/workspace
+RUN mkdir -p $BUILD_INPUT_DIR
+
+WORKDIR $BUILD_INPUT_DIR
-- 
GitLab