-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile-Slim
100 lines (89 loc) · 4.23 KB
/
Dockerfile-Slim
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
99
100
# mluckydwyer/hw-ci Docker Container
FROM centos:7 as base
LABEL \
org.opencontainers.image.title="Hardware Verification CI Docker container" \
org.opencontainers.image.description="Modelsim, Verilator, GHDL, VUnit, CocoTB, and Pytest for HW Development (+VNC)." \
org.opencontainers.image.authors="Matthew Dwyer <[email protected]>" \
org.opencontainers.image.source="https://github.com/Mluckydwyer/hw-ci"
ENV container docker
# Update Yum Repos & Update All
RUN curl -o /tmp/endpoint-rpmsign-7.pub https://packages.endpointdev.com/endpoint-rpmsign-7.pub \
&& rpm --import /tmp/endpoint-rpmsign-7.pub \
&& rpm -qi gpg-pubkey-703df089 | gpg --with-fingerprint \
&& rm /tmp/endpoint-rpmsign-7.pub \
&& yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm \
&& yum update -y \
&& yum install -y git make epel-release
# Install Python3
FROM base as python3
ENV PYTHON_VER=3.9.13
RUN yum -y install gcc gcc-c++ libstdc++-devel \
&& yum -y install libgcc.i686 glibc-devel.i686 glibc.i686 zlib-devel.i686 \
readline-devel.i686 gdbm-devel.i686 openssl-devel.i686 ncurses-devel.i686 \
tcl-devel.i686 db4-devel.i686 bzip2-devel.i686 libffi-devel.i686 \
&& mkdir /tmp/{Archive,Build} \
&& curl -sSL https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tgz -o /tmp/Archive/Python-${PYTHON_VER}.tgz \
&& tar xzvf /tmp/Archive/Python-${PYTHON_VER}.tgz -C /tmp/Build \
&& rm /tmp/Archive/Python-${PYTHON_VER}.tgz \
&& mkdir -p /opt/Python-${PYTHON_VER} \
&& cd /tmp/Build/Python-${PYTHON_VER} \
&& CFLAGS=-m32 LDFLAGS=-m32 ./configure --prefix /opt/Python-${PYTHON_VER} --enable-shared \
&& LD_RUN_PATH=/opt/Python-${PYTHON_VER}/lib make -j 8 \
&& make install \
&& cd / \
&& rm -rf /tmp/Build
ENV PATH="/opt/Python-${PYTHON_VER}/bin:${PATH}"
ENV LD_LIBRARY_PATH="/opt/Python-${PYTHON_VER}/lib:/opt/Python-${PYTHON_VER}/share:${LD_LIBRARY_PATH}"
ENV CPATH="/opt/Python-${PYTHON_VER}/include:${CPATH}"
RUN pip3 install --upgrade pip setuptools \
&& pip3 install wheel
# Install Verilator
FROM python3 as verilator
RUN yum -y install verilator
# Install GHDL
FROM verilator as ghdl
ENV OG_PATH=$PATH
ENV PATH=/tmp/gnat/bin:$PATH
RUN yum -y install bzip2 curl flex fontconfig zlib-devel centos-release-scl gcc gcc-c++ libstdc++-devel swig python-devel glibc.i686 glibc-devel.i386 libgcc.i686 libstdc++-devel.i686 \
&& yum install -y texinfo
RUN mkdir -p /tmp/gnat \
&& cd /tmp \
&& curl -sSL https://hchvba.dm.files.1drv.com/y4mA1UGAe9IA9O37PH7tD5_m_fDEwwsIytbH5YeQ68D-TTbU99h2_SOsPYoZ2X4fWewc69nwBeYBfq6aWiOmKa184HbiiH6tThYOEM3iRDbTIXyCdvbJ2fOFhjsbYZrazSUD53ZglI71KX0J9Z0VmiWHqgo_rneUVQdYYpSTiZzatnvJgcLtai1Ve4hxFSiqlt_LncJ2w7iVAhzJ_aBqPlHGQ | \
tar -xz -C /tmp/gnat --strip-components=1 \
&& cd .. \
&& mkdir -p ghdl-2.0.0 \
&& curl -sSL https://github.com/ghdl/ghdl/archive/refs/tags/v2.0.0.tar.gz | tar -xz -C ./ghdl-2.0.0 --strip-components=1 \
&& cd ghdl-2.0.0 \
&& ./configure --disable-werror --prefix=/usr/local \
&& make -j4 \
&& make install \
&& pip3 install pyghdl \
&& cd / \
&& rm -rf /tmp/* \
&& pip3 install pyghdl
ENV PATH=$OG_PATH
# Install CocoTb
FROM ghdl 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 fixedpoint pyvsc
# Makepp + M4
FROM cocotb as makepp
RUN yum -y install make perl perl-Digest-MD5 m4 \
&& mkdir /tmp/{Archive,Build} \
&& curl -sSL https://versaweb.dl.sourceforge.net/project/makepp/2.0/makepp-2.0.tgz -o /tmp/Archive/makepp-2.0.tgz \
&& tar xzvf /tmp/Archive/makepp-2.0.tgz -C /tmp/Build \
&& cd /tmp/Build/makepp-2.0 \
&& ./configure --prefix=/usr/local \
&& make install \
&& rm -rf /tmp/*
# User [coder:coder]
# RUN useradd -ms /bin/bash coder -m -G wheel,root -p "$(openssl passwd -1 coder)"
# RUN usermod -aG wheel coder
# USER coder
# ENV USER=coder
# WORKDIR /home/coder
FROM makepp as final
# RUN mkdir -p /workspaces/logs
WORKDIR /workspaces/
# RUN chmod +rw /root/ -R