diff --git a/Makefile b/Makefile index 4a67726ea6..31a304cecc 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ dockers_dir := dockers build_dockerfile := $(dockers_dir)/Dockerfile.compile release_dockerfile := $(dockers_dir)/Dockerfile.release output_dir := out/Default -target_dir := target/ +target_dir := target target_lib_dir := $(target_dir)/lib target_bin_dir := $(target_dir)/bin @@ -19,7 +19,7 @@ all: make release init: - docker build dockers -f $(build_dockerfile) -t $(compile_docker) + docker build dockers --build-arg UID=$(shell id -u) --build-arg GUID=$(shell id -g) -f $(build_dockerfile) -t $(compile_docker) release: docker build $(target_dir) -f $(release_dockerfile) -t $(release_docker) diff --git a/dockers/Dockerfile.compile b/dockers/Dockerfile.compile index 238f62d1b0..4cc112be46 100644 --- a/dockers/Dockerfile.compile +++ b/dockers/Dockerfile.compile @@ -3,10 +3,22 @@ FROM ubuntu:18.04 RUN apt-get update && apt-get install -y \ git curl wget python libglib2.0-dev clang +# Add ONL user +ARG USER=onl +ARG UID +ARG GUID + +RUN groupadd -f -r -g ${GUID} g${USER} +RUN useradd ${USER} -l -u ${UID} -g ${GUID} -m -s /bin/bash + +# Download depot_tools ARG DEPOT_TOOLS=/opt/depot_tools ARG DOCKER_WORKDIR=/app/AlphaRTC/ RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git ${DEPOT_TOOLS} +RUN chown ${USER} -R ${DEPOT_TOOLS} ENV PATH="${DEPOT_TOOLS}/:${PATH}" WORKDIR "${DOCKER_WORKDIR}/" + +USER ${USER}