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 # WORKDIR /iverilog RUN make check FROM base as release-candidate COPY --from=builder /usr/local /usr/local/ 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. # # The make and make clean lines below fail if iverilog/dockerfiles/test isn't available # and older release branches like v10_3 do not have this directory, so we need a # layer that does have it to copy from. We create that layer as test-branch here: # FROM builder as test-branch # WORKDIR /iverilog # ARG TEST_BRANCH=master # RUN git checkout ${TEST_BRANCH} # # FROM release-candidate-entrypoint-make as test-release-candidate-entrypoint-make # COPY --from=test-branch /iverilog/dockerfiles/test /home/ic/ # # RUN make # RUN make clean FROM release-candidate-entrypoint-make as iverilog-make FROM release-candidate as iverilog # Below are some sample commands to build docker images. # # The following builds iverilog from the source in the current directory # docker build . -t iverilog # # The following builds the latest code from the Thirsty2/iverilog fork master branch # docker build --build-arg IVERILOG_REPO_URL=https://github.com/Thirsty2/iverilog.git --build-arg TEST_BRANCH=add-dockerfile . -t iverilog # # The following won't work until the pull request is accepted, but should work afterwards to build the master branch of steveicarus/iverilog # docker build . -t iverilog