forked from crops/toaster-container
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
64 lines (54 loc) · 2.28 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
56
57
58
59
60
61
62
63
64
# Copyright (C) 2015-2016 Intel Corporation
# Copyright (C) 2022 Konsulko Group
#
# SPDX-License-Identifier: GPL-2.0-only
FROM crops/yocto:ubuntu-18.04-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 primetoaster.sh \
toaster-launch.sh \
toaster-entry.py \
/usr/bin/
COPY sudoers.usersetup /etc/
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
# 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 export DEBIAN_FRONTEND=noninteractive && apt-get -y update && \
apt-get -y install python3-pip python3-venv sudo sqlite tzdata && \
apt-get clean && \
userdel -r yoctouser && \
groupadd -g 70 usersetup && \
useradd -N -m -u 70 -g 70 usersetup && \
chmod 755 /usr/bin/primetoaster.sh \
/usr/bin/usersetup.py \
/usr/bin/toaster-launch.sh \
/usr/bin/toaster-entry.py \
/usr/bin/restrict_groupadd.sh \
/usr/bin/restrict_useradd.sh && \
echo "#include /etc/sudoers.usersetup" >> /etc/sudoers
# Set up a python virtual environment
RUN mkdir /opt/venv
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN chmod -R 0777 ${VIRTUAL_ENV}
USER usersetup
ENV LANG=en_US.UTF-8
# Install the toaster requirements.
ARG BRANCH
ARG GITREPO
RUN git clone $GITREPO --depth=1 --branch=$BRANCH /home/usersetup/poky
RUN ${VIRTUAL_ENV}/bin/activate
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install -r /home/usersetup/poky/bitbake/toaster-requirements.txt
RUN primetoaster.sh /home/usersetup /home/usersetup/poky
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/bin/toaster-entry.py"]