Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
USER_ID=1000
USER_GID=1000
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
# 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

# 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 \
Expand All @@ -39,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"]
23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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: .
image: crops/poky:latest

environment:
- USER_ID
- USER_GID

volumes:
- ./workspace:/workspace
3 changes: 2 additions & 1 deletion poky-entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file added workspace/README
Empty file.