-
Notifications
You must be signed in to change notification settings - Fork 96
/
Dockerfile
55 lines (47 loc) · 2.25 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright (C) 2015-2016 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Since this Dockerfile is used in multiple images, force the builder to
# specify the BASE_DISTRO. This should hopefully prevent accidentally using
# a default, when another distro was desired.
ARG BASE_DISTRO=SPECIFY_ME
FROM crops/yocto:$BASE_DISTRO-base
USER root
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 \
/usr/bin/
COPY distro-entry.sh poky-entry.py poky-launch.sh /usr/bin/
COPY sudoers.usersetup /etc/
# For ubuntu, do not use dash.
RUN which dash &> /dev/null && (\
echo "dash dash/sh boolean false" | debconf-set-selections && \
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash) || \
echo "Skipping dash reconfigure (not applicable)"
# We remove the user because we add a new one of our own.
# The usersetup user is solely for adding a new user that has the same uid,
# as the workspace. 70 is an arbitrary *low* unused uid on debian.
RUN userdel -r yoctouser && \
mkdir /home/yoctouser && \
groupadd -g 70 usersetup && \
useradd -N -m -u 70 -g 70 usersetup && \
chmod 755 /usr/bin/usersetup.py \
/usr/bin/poky-entry.py \
/usr/bin/poky-launch.sh \
/usr/bin/restrict_groupadd.sh \
/usr/bin/restrict_useradd.sh && \
echo "#include /etc/sudoers.usersetup" >> /etc/sudoers
USER usersetup
ENV LANG=en_US.UTF-8
ENTRYPOINT ["/usr/bin/distro-entry.sh", "/usr/bin/dumb-init", "--", "/usr/bin/poky-entry.py"]