From ebb3371b85cd0a967cb04c04fc585a1bb7ea6786 Mon Sep 17 00:00:00 2001 From: nosamad Date: Wed, 20 Mar 2019 01:32:55 +0100 Subject: [PATCH] changes user id mapping --- .travis.yml | 1 + Makefile | 8 +++++--- docker/wsfs-builder-amd64-ubuntu.dockerfile | 4 +++- docker/wsfs-builder-arm32v7-ubuntu.dockerfile | 5 ++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 05a8884..05c217d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +language: minimal services: - docker addons: diff --git a/Makefile b/Makefile index adf5dfb..a809e32 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,9 @@ PROJECT_ROOT ?= . OUT ?= $(PROJECT_ROOT)/.build VERSION ?= $(shell cat $(PROJECT_ROOT)/VERSION) NPROC ?= $(shell nproc) +UID ?= $(shell id -u) DOCKER ?= docker -DOCKER_RUNUSER ?= $(shell id -u) +DOCKER_RUNUSER ?= $(UID) DOCKER_RUNGROUP ?= $(shell id -g) UBUNTU_CODENAME ?= bionic @@ -28,13 +29,14 @@ $(MARCH_ARM32V7)TARGETS += wsfs-builder-arm32v7-ubuntu DOCKER_RUNFLAGS += --interactive DOCKER_RUNFLAGS += --rm DOCKER_RUNFLAGS += --tty -DOCKER_RUNFLAGS += --init +DOCKER_RUNFLAGS += --init DOCKER_RUNFLAGS += --user $(DOCKER_RUNUSER):$(DOCKER_RUNGROUP) DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH DOCKER_BUILDARGS += CODENAME=$(CODENAME) DOCKER_BUILDARGS += NPROC=$(NPROC) +DOCKER_BUILDARGS += USERID=$(UID) DOCKER_BUILDFLAGS += $(addprefix --build-arg ,$(DOCKER_BUILDARGS)) @@ -103,7 +105,7 @@ $(OUT)/%/CMakeCache.txt: $(PROJECT_ROOT)/CMakeLists.txt $(OUT)/docker/% | $(OUT_ cmake -GNinja $(CMAKEFLAGS) .. && touch $@ $(CHECK_TARGETS): GLOAS := test -$(CHECK_TARGETS): DOCKER_RUNUSER := test +$(CHECK_TARGETS): DOCKER_RUNUSER := user check-%: compile-%; diff --git a/docker/wsfs-builder-amd64-ubuntu.dockerfile b/docker/wsfs-builder-amd64-ubuntu.dockerfile index 7f0b310..2d6f9b0 100644 --- a/docker/wsfs-builder-amd64-ubuntu.dockerfile +++ b/docker/wsfs-builder-amd64-ubuntu.dockerfile @@ -73,6 +73,8 @@ RUN set -x \ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib -RUN useradd -ms /bin/bash test +ARG USERID=1000 + +RUN useradd -u $USERID -ms /bin/bash user diff --git a/docker/wsfs-builder-arm32v7-ubuntu.dockerfile b/docker/wsfs-builder-arm32v7-ubuntu.dockerfile index fc09ef0..3cea608 100644 --- a/docker/wsfs-builder-arm32v7-ubuntu.dockerfile +++ b/docker/wsfs-builder-arm32v7-ubuntu.dockerfile @@ -75,6 +75,9 @@ RUN set -x \ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib -RUN useradd -ms /bin/bash test +ARG USERID=1000 + +RUN useradd -u $USERID -ms /bin/bash user +