-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathDockerfile
99 lines (84 loc) · 2.71 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
FROM ubuntu:16.04
LABEL description="PELUX Yocto build environment"
# Enables us to overwrite the user and group ID for the yoctouser. See below
ARG userid=1000
ARG groupid=1000
USER root
# Install dependencies in one command to avoid potential use of previous cache
# like explained here: https://stackoverflow.com/a/37727984
RUN apt-get update && \
apt-get install -y \
bc \
build-essential \
chrpath \
coreutils \
cpio \
curl \
cvs \
debianutils \
diffstat \
g++-multilib \
gawk \
gcc-multilib \
git-core \
graphviz \
help2man \
iptables \
iputils-ping \
libegl1-mesa \
libfdt1 \
libsdl1.2-dev \
libxml2-utils \
locales \
m4 \
openssh-server \
python \
python-pysqlite2 \
python3 \
python3-git \
python3-jinja2 \
python3-pexpect \
python3-pip \
qemu-user \
repo \
rsync \
screen \
socat \
subversion \
sudo \
sysstat \
texinfo \
tmux \
unzip \
wget \
xz-utils
RUN apt-get clean
# For Yocto bitbake -c testimage XML reporting
RUN pip3 install unittest-xml-reporting
# For git-lfs
# The downloaded script is needed since git-lfs is not available per default for Ubuntu 16.04
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash && sudo apt-get install -y git-lfs
# Remove all apt lists to avoid build caching
RUN rm -rf /var/lib/apt/lists/*
# en_US.utf8 is required by Yocto sanity check
RUN /usr/sbin/locale-gen en_US.UTF-8
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
RUN echo 'export LC_ALL="en_US.UTF-8"' >> /etc/profile
ENV LANG en_US.utf8
RUN useradd -U -m yoctouser
# Make sure the user/groupID matches the UID/GID given to Docker. This is so that mounted
# dirs will get the correct permissions
RUN usermod --uid $userid yoctouser
RUN groupmod --gid $groupid yoctouser
RUN echo 'yoctouser:yoctouser' | chpasswd
RUN echo 'yoctouser ALL=(ALL) NOPASSWD:SETENV: ALL' > /etc/sudoers.d/yoctouser
# Copy cookbook
ADD --chown=yoctouser:yoctouser cookbook /tmp/cookbook/
USER yoctouser
WORKDIR /home/yoctouser
# Script which allows to pass containers CMD as an argument to timeout command
# in case we need redefine entrypoint '--entrypoint' key can be used durring container start
RUN echo "#!/usr/bin/env bash" >> /home/yoctouser/docker-ep.sh && \
echo 'exec timeout --signal=SIGKILL 21600 "$@"' >> /home/yoctouser/docker-ep.sh && \
chmod +x /home/yoctouser/docker-ep.sh
ENTRYPOINT ["/home/yoctouser/docker-ep.sh"]