Dockerfile
 1  # This dockerfile is not meant to be used directly by docker.  The
 2  # {{}} varibles are replaced with values by the makefile.  Please generate
 3  # the docker image for this file by running:
 4  #
 5  #   make coreboot-jenkins-node
 6  #
 7  # Variables can be updated on the make command line or left blank to use
 8  # the default values set by the makefile.
 9  #
10  #  SDK_VERSION is used to name the version of the coreboot sdk to use.
11  #              Typically, this corresponds to the toolchain version.
12  #  SSH_KEY is the contents of the file coreboot-jenkins-node/authorized_keys
13  #          Because we're piping the contents of the dockerfile into the
14  #          docker build command, the 'COPY' keyword isn't valid.
15  
16  FROM coreboot/coreboot-sdk:{{SDK_VERSION}}
17  USER root
18  
19  RUN apt-get -y update && \
20  	apt-get -y install \
21  		default-jre-headless \
22  		libcmocka-dev \
23  		liblua5.4-dev \
24  		linkchecker \
25  		lua5.4 \
26  		openssh-server \
27  		parallel \
28  		ruby-full \
29  		sdcc \
30  		python3-pip \
31  		pykwalify \
32  		python3-venv \
33  		python3-yaml \
34  		python3-pyelftools \
35  		python3-jsonschema \
36  		python3-colorama \
37  		python3-pyrsistent \
38  		swig \
39  	&& apt-get clean \
40  	&& gem install mdl
41  
42  RUN mkdir /var/run/sshd && \
43  	chmod 0755 /var/run/sshd && \
44  	/usr/bin/ssh-keygen -A
45  
46  # Create tmpfs directories to build in
47  RUN mkdir /cb-build && \
48  	chown coreboot:coreboot /cb-build && \
49  	echo "tmpfs /cb-build tmpfs rw,mode=1777,noatime 0 0" > /etc/fstab && \
50  	mkdir -p /home/coreboot/node-root/workspace && \
51  	chown -R coreboot:coreboot /home/coreboot/node-root && \
52  	echo "tmpfs /home/coreboot/node-root/workspace tmpfs rw,mode=1777,strictatime,atime 0 0" >> /etc/fstab && \
53  	chown coreboot:coreboot /home/coreboot/.ccache && \
54  	echo "tmpfs /home/coreboot/.ccache tmpfs rw,mode=1777 0 0" >> /etc/fstab
55  
56  # Build encapsulate tool
57  ADD https://raw.githubusercontent.com/coreboot/encapsulate/master/encapsulate.c /tmp/encapsulate.c
58  RUN gcc -o /usr/sbin/encapsulate /tmp/encapsulate.c && \
59  	chown root /usr/sbin/encapsulate && \
60  	chmod +s /usr/sbin/encapsulate
61  
62  VOLUME /data/cache
63  ENTRYPOINT mount /cb-build && \
64  	mount /home/coreboot/node-root/workspace && \
65  	chown -R coreboot:coreboot /home/coreboot/node-root && \
66  	mount /home/coreboot/.ccache && \
67  	chown coreboot:coreboot /home/coreboot/.ccache && \
68  	/usr/sbin/sshd -p 49151 -D
69  EXPOSE 49151
70  
71  USER coreboot
72  ENV VIRTUAL_ENV="/home/coreboot/python3"
73  ENV PATH=$VIRTUAL_ENV/bin:$PATH:/home/coreboot/.local/bin
74  RUN echo 'export PATH=$PATH:/opt/xgcc/bin' >> /home/coreboot/.bashrc && \
75  	echo "source ${VIRTUAL_ENV}/bin/activate"  >> /home/coreboot/.bashrc && \
76  	python3 -m venv /home/coreboot/python3 && \
77  	pip3 install --upgrade --no-cache-dir pip && \
78  	pip3 install --no-cache-dir \
79  		setuptools==58.2.0 \
80  		jinja2==3.1.3 \
81  		myst-parser===2.0.0 \
82  		sphinx===7.2.6 \
83  		sphinxcontrib-ditaa===1.0.2 \
84  		sphinx_autobuild===2024.2.4 \
85  		sphinx_rtd_theme===2.0.0 \
86  	&& mkdir -p /home/coreboot/.ssh && \
87  	echo "{{SSH_KEY}}" > /home/coreboot/.ssh/authorized_keys && \
88  	chmod 0700 /home/coreboot/.ssh && \
89  	chmod 0600 /home/coreboot/.ssh/authorized_keys
90  USER root