iverilog/Dockerfile.ubuntu

99 lines
3.1 KiB
Docker

ARG IMAGE="ubuntu:18.04"
# Note that some commands such as 'apk add' won't work in arbitrary images. For instance,
# 'apt-get' works fine under ubuntu, but not under alpine (at least not by default.)
# In other words, the following 'apt-get' sections assume a debian based image or a derivitive
FROM $IMAGE as base
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && \
apt-get install -y \
make && \
rm -rf /var/lib/apt/lists/*
FROM base as builder
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && \
apt-get install -y \
autoconf \
automake \
bison \
build-essential \
flex \
git \
gperf
COPY . .
RUN bash autoconf.sh && \
./configure && \
make && \
make install
FROM builder as builder-iverilog-regression-test
RUN make check
ARG REGRESSION_TEST_URL=https://github.com/steveicarus/ivtest.git
RUN git clone ${REGRESSION_TEST_URL} ivtest
# Running the tests here was useful for troubleshooting, but we also run them below
# in a lighter weight image so it is not necessary to run them here anymore
# WORKDIR ivtest
# RUN perl vvp_reg.pl
# RUN perl vpi_reg.pl
FROM base as release-candidate
COPY --from=builder /usr/local /usr/local/
FROM release-candidate as iverilog-vpi
RUN apt-get update && \
apt-get install -y \
build-essential
FROM iverilog-vpi as test-iverilog-vpi
RUN apt-get update && \
apt-get install -y \
perl
COPY --from=builder-iverilog-regression-test /ivtest /ivtest
WORKDIR /ivtest
RUN perl vvp_reg.pl
RUN perl vpi_reg.pl
FROM release-candidate as iverilog
#
# Below are some sample commands to build docker images.
#
# The vpi_reg.pl script wont run in this 121 MB image which does not contain perl or c/c++
# docker build -f Dockerfile.ubuntu . -t iverilog
#
# This is a larger 364 MB image with c/c++ compilers through build-essential
# docker build -f Dockerfile.ubuntu --target iverilog-vpi . -t iverilog-vpi
#
# This is a larger 382 MB image with c/c++ compilers throubh build-essential and perl
# docker build -f Dockerfile.ubuntu --target test-iverilog-vpi . -t iverilog-perl
#
# This is a larger 665 MB image with full featured compiler, git, and full build results
# docker build -f Dockerfile.ubuntu --target builder . -t iverilog-builder
#
# Below are some sample commands to build using ubuntu:20.04 as a base image
#
# The vpi_reg.pl script wont run in this 154 MB image which does not contain perl or c/c++
# docker build -f Dockerfile.ubuntu --build-arg IMAGE="ubuntu:20.04" . -t iverilog
#
# This is a larger 428 MB image with c/c++ compilers through build-essential
# docker build -f Dockerfile.ubuntu --build-arg IMAGE="ubuntu:20.04" --target iverilog-vpi . -t iverilog-vpi
#
# This is a larger 445 MB image with c/c++ compilers throubh build-essential and perl
# docker build -f Dockerfile.ubuntu --build-arg IMAGE="ubuntu:20.04" --target test-iverilog-vpi . -t iverilog-perl
#
# This is a larger 812 MB image with full featured compiler, git, and full build results
# docker build -f Dockerfile.ubuntu --build-arg IMAGE="ubuntu:20.04" --target builder . -t iverilog-builder