-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile-Ubuntu
74 lines (63 loc) · 2.8 KB
/
Dockerfile-Ubuntu
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
# mluckydwyer/hw-ci Docker Container
FROM ubuntu:20.04 as base
LABEL \
org.opencontainers.image.title="Hardware Verification CI Docker container" \
org.opencontainers.image.description="Verilator, GHDL, VUnit, CocoTB, and Pytest for HW Development (+VNC)." \
org.opencontainers.image.authors="Matthew Dwyer <dwyer@iastate.edu>" \
org.opencontainers.image.source="https://github.com/Mluckydwyer/hw-ci"
ENV \
container docker \
# DISPLAY=host.docker.internal:0.0 \
LIBGL_ALWAYS_INDRIECT=1
# Update Yum Repos & Update All
RUN apt-get update \
&& apt-get -y upgrade
# Install Python3 & Compilers
FROM base as python3
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -y install python3 python3-pip gcc g++ m4 make makepp cmake clang texinfo curl wget \
&& pip3 install wheel
# Install Verilator & GHDL
FROM python3 as hdl_sims
WORKDIR /opt/
RUN apt-get -y install verilator iverilog \
&& wget https://github.com/ghdl/ghdl/releases/download/nightly/ghdl-gha-ubuntu-20.04-mcode.tgz \
&& mkdir ghdl \
&& tar xzvf ghdl-gha-ubuntu-20.04-mcode.tgz -C /opt/ghdl/ \
&& rm ghdl-gha-ubuntu-20.04-mcode.tgz \
&& cd ghdl \
&& cp -r -f ./bin/* /usr/bin/ \
&& cp -r -f ./lib/* /usr/lib/ \
&& cp -r -f ./include/* /usr/include/ \
&& cd /opt \
&& rm -rf /opt/ghdl
# Install CocoTb
FROM hdl_sims as cocotb
RUN pip3 install glob2 coverage cocotb cocotb_bus cocotb-test cocotb-coverage cocotbext-axi python-constraint \
pytest pytest-parallel pytest-xdist pytest-html pytest-sugar pytest-randomly pytest-emoji \
pytest-icdiff pytest-asyncio pytest-rerunfailures pytest-repeat \
&& pip3 install pyghdl vunit_hdl fixedpoint pyvsc
FROM cocotb as qol
RUN apt-get -y install bash htop vim nano openssl firefox dos2unix gtkwave \
&& pip3 install matplotlib remote_pdb debugpy symbolator teroshdl yowasp-yosys vsg
# VNC Server for GUI applications
FROM qol as vnc
ENV WINDOW_MANAGER="openbox"
EXPOSE 5900 6080
RUN apt-get -y install xvfb x11vnc xterm openbox obconf sed git \
&& pip3 install numpy \
&& sed -ri "s/<number>4<\/number>/<number>1<\/number>/" /etc/xdg/openbox/rc.xml \
&& git clone --depth 1 https://github.com/novnc/noVNC.git /opt/novnc \
&& git clone --depth 1 https://github.com/novnc/websockify /opt/novnc/utils/websockify \
&& echo "export DISPLAY=:0" >> ~/.bashrc \
&& echo "[ ! -e /tmp/.X0-lock ] && (/usr/bin/start-vnc-session.sh &> /tmp/display-\${DISPLAY}.log)" >> ~/.bashrc
COPY resources/novnc-index.html /opt/novnc/index.html
COPY resources/start-vnc-session.sh /usr/bin/
RUN chmod +x /usr/bin/start-vnc-session.sh
FROM vnc as final
ENV PATH=/workspaces/tools:$PATH
WORKDIR /workspaces/
COPY ./resources /workspaces/tools
RUN chmod +x /workspaces/tools/*.sh \
&& chmod +rw /root/ -R
ENTRYPOINT /usr/bin/startup.sh