97 lines
2.3 KiB
Docker
97 lines
2.3 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 test-builder
|
|
|
|
RUN make check
|
|
|
|
FROM base as test-release-candidate
|
|
|
|
COPY --from=builder /usr/local /usr/local/
|
|
|
|
FROM test-release-candidate as release-candidate
|
|
|
|
RUN adduser --disabled-password ic
|
|
USER ic
|
|
WORKDIR /home/ic
|
|
|
|
FROM release-candidate as release-candidate-entrypoint-make
|
|
|
|
ENTRYPOINT [ "make" ]
|
|
|
|
# This commented section or something similar may be used to test the release candidate
|
|
# image before it is finally released. A failure here would stop the process so that
|
|
# a faulty image is not released.
|
|
#
|
|
# We create a layer that contains the tests as builder-iverilog-regression-test here:
|
|
|
|
FROM builder as builder-iverilog-regression-test-base
|
|
|
|
ARG REGRESSION_TEST_URL=https://github.com/steveicarus/ivtest.git
|
|
RUN git clone ${REGRESSION_TEST_URL} ivtest
|
|
|
|
FROM builder-iverilog-regression-test-base as builder-iverilog-regression-test
|
|
|
|
WORKDIR ivtest
|
|
RUN perl vvp_reg.pl
|
|
RUN perl vpi_reg.pl
|
|
|
|
FROM test-release-candidate as test-release-candidate-perl
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y \
|
|
perl
|
|
|
|
RUN adduser --disabled-password ic
|
|
USER ic
|
|
WORKDIR /home/ic
|
|
|
|
COPY --from=builder-iverilog-regression-test-base /ivtest /home/ic/
|
|
|
|
RUN perl vvp_reg.pl
|
|
# RUN perl vpi_reg.pl
|
|
# RUN perl vhdl_reg.pl
|
|
|
|
FROM release-candidate-entrypoint-make as iverilog-make
|
|
|
|
FROM release-candidate as iverilog
|
|
|
|
# Below are some sample commands to build docker images.
|
|
#
|
|
# docker build -f Dockerfile.ubuntu1804 . -t iverilog
|
|
#
|
|
# docker build -f Dockerfile.ubuntu1804 --target iverilog-make . -t iverilog-make
|
|
|