From 762c995c535ab1da10f6e6bde130d90ef928b805 Mon Sep 17 00:00:00 2001 From: Nicola Lunghi Date: Fri, 9 Mar 2018 10:51:47 +0000 Subject: [PATCH 1/5] Switch to Ubuntu 16.04 Signed-off-by: Nicola Lunghi --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 29c386c..76023a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -FROM crops/yocto:ubuntu-14.04-base +FROM crops/yocto:ubuntu-16.04-base USER root From 4111d2cdf0f5f53c3bfcb37bf8e70c9b7bc3bf71 Mon Sep 17 00:00:00 2001 From: Nicola Lunghi Date: Fri, 9 Mar 2018 10:55:23 +0000 Subject: [PATCH 2/5] Add the repo tool to the image Signed-off-by: Nicola Lunghi --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile b/Dockerfile index 76023a5..e8244a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,11 @@ FROM crops/yocto:ubuntu-16.04-base USER root +# The repo tool is used by a lot of yocto builds add it +RUN apt-get update \ + && apt-get install -y repo \ + && rm -rf /var/lib/apt/lists/* + ADD https://raw.githubusercontent.com/crops/extsdk-container/master/restrict_useradd.sh \ https://raw.githubusercontent.com/crops/extsdk-container/master/restrict_groupadd.sh \ https://raw.githubusercontent.com/crops/extsdk-container/master/usersetup.py \ From 815e84a9246ec377c93889dff8f88b50f7924eee Mon Sep 17 00:00:00 2001 From: Nicola Lunghi Date: Fri, 9 Mar 2018 10:22:57 +0000 Subject: [PATCH 3/5] Add the possibility to change UID/GID setting environment variables Signed-off-by: Nicola Lunghi --- Dockerfile | 1 + poky-entry.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e8244a9..bfa6664 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,5 +44,6 @@ RUN userdel -r yoctouser && \ USER usersetup ENV LANG=en_US.UTF-8 +ENV USER_ID=1000 USER_GID=1000 ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/bin/poky-entry.py"] diff --git a/poky-entry.py b/poky-entry.py index 5e057fe..7b5a599 100755 --- a/poky-entry.py +++ b/poky-entry.py @@ -44,7 +44,8 @@ if args.id: uid, gid = args.id.split(":") idargs = "--uid={} --gid={}".format(uid, gid) - +elif os.environ.get('USER_ID') and os.environ.get('USER_GID'): + idargs = "--uid={} --gid={}".format(os.environ['USER_ID'], os.environ['USER_GID']) elif args.workdir == '/home/pokyuser': # If the workdir wasn't specified pick a default uid and gid since # usersetup won't be able to calculate it from the non-existent workdir From 4f958d24c467bb915b01181e0798a8155706daad Mon Sep 17 00:00:00 2001 From: Nicola Lunghi Date: Fri, 9 Mar 2018 10:46:06 +0000 Subject: [PATCH 4/5] Added a docker-compose.yml file to simplify running this Signed-off-by: Nicola Lunghi --- .env | 2 ++ docker-compose.yml | 23 +++++++++++++++++++++++ workspace/README | 0 3 files changed, 25 insertions(+) create mode 100644 .env create mode 100644 docker-compose.yml create mode 100644 workspace/README diff --git a/.env b/.env new file mode 100644 index 0000000..3a8c6a2 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +USER_ID=1000 +USER_GID=1000 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ddcc1ee --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +# +# set the USER_ID and USER_GID in the .env file +# +# $ printf "USER_ID=$(id -u)\nUSER_GID=$(id -g)\n" > .env +# +# then launch this with: +# +# $ docker-compose build poky +# $ docker-compose run --rm poky + +version: '2' + +services: + poky: + build: ./poky-container + image: crops/poky:latest + + environment: + - USER_ID + - USER_GID + + volumes: + - ./workspace:/workspace diff --git a/workspace/README b/workspace/README new file mode 100644 index 0000000..e69de29 From b1c18443050ca2cfc0ae25f4b9610e1c734a9f61 Mon Sep 17 00:00:00 2001 From: Nicola Lunghi Date: Fri, 9 Mar 2018 11:11:49 +0000 Subject: [PATCH 5/5] Fixed wrong path in docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index ddcc1ee..b0f52da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ version: '2' services: poky: - build: ./poky-container + build: . image: crops/poky:latest environment: