From b97ff24bee2ef1707c9eed72d7e095dbb82c2a47 Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Thu, 6 Aug 2020 18:42:29 -0700 Subject: [PATCH 01/10] Add a Dockerfile in the iverilog directory, along with github actions to build it. --- .github/workflows/docker-publish.yml | 76 ++++++++++++++++++++++++++++ Dockerfile | 38 ++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 .github/workflows/docker-publish.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000000..f5319dce3c --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,76 @@ +name: Docker + +on: + push: + # Publish `master` as Docker `latest` image. + branches: + - master + + # Publish `v1.2.3` tags as releases. + tags: + - v* + + # Run tests for any PRs. + pull_request: + +env: + # TODO: Change variable to your image's name. + IMAGE_NAME: iverilog + +jobs: + # Run tests. + # See also https://docs.docker.com/docker-hub/builds/automated-testing/ + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run tests + run: | + if [ -f docker-compose.test.yml ]; then + docker-compose --file docker-compose.test.yml build + docker-compose --file docker-compose.test.yml run sut + else + docker build --build-arg GITHUB_WORKSPACE=$GITHUB_WORKSPACE . --file Dockerfile + fi + + # Push image to GitHub Packages. + # See also https://docs.docker.com/docker-hub/builds/ + push: + # Ensure test job passes before pushing image. + needs: test + + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - uses: actions/checkout@v2 + + - name: Build image + run: docker build --build-arg GITHUB_WORKSPACE=$GITHUB_WORKSPACE . --file Dockerfile --tag $IMAGE_NAME + + - name: Log into registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin + + - name: Push image + run: | + IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..9abbe44556 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM ubuntu:18.04 as builder + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -y update && \ + apt-get install -y \ + autoconf \ + automake \ + bison \ + build-essential \ + flex \ + git \ + gperf && \ + rm -rf /var/lib/apt/lists/* + +COPY . . + +RUN bash ./autoconf.sh && \ + ./configure && \ + make && \ + make install + +FROM ubuntu:18.04 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -y update && \ + apt-get install -y \ + make && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=builder /usr/local /usr/local/ + +WORKDIR /home/ic +ENTRYPOINT [ "make" ] + + + From b19ed43c8b7ce042ef7d83a4053056a2bb4001b6 Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Fri, 2 Oct 2020 14:39:41 -0700 Subject: [PATCH 02/10] Use alpine linux 3.12 as default, ubuntu1804 alternative added. --- Dockerfile | 78 ++++++++++++++++++++++++++++++++-------- Dockerfile.ubuntu1804 | 84 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 15 deletions(-) create mode 100644 Dockerfile.ubuntu1804 diff --git a/Dockerfile b/Dockerfile index 9abbe44556..947a688373 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,86 @@ -FROM ubuntu:18.04 as builder +ARG IMAGE="alpine:3.12" +# Note that some commands such as 'apk add' won't work in arbitrary images. For instance, +# 'apk add' works fine under alpine, but not under Ubuntu (at least not by default.) +# In other words, the following 'apk add' sections assume an alpine based image or a derivitive -ARG DEBIAN_FRONTEND=noninteractive +FROM $IMAGE as base -RUN apt-get -y update && \ - apt-get install -y \ +RUN apk add --no-cache \ + bzip2 \ + libbz2 \ + libgcc \ + libhistory \ + libstdc++ \ + make \ + readline \ + zlib + +FROM base as builder + +RUN apk add --no-cache \ autoconf \ - automake \ + build-base \ bison \ - build-essential \ + bzip2-dev \ flex \ git \ - gperf && \ - rm -rf /var/lib/apt/lists/* + gperf \ + readline-dev \ + zlib-dev COPY . . -RUN bash ./autoconf.sh && \ +RUN sh autoconf.sh && \ ./configure && \ make && \ make install -FROM ubuntu:18.04 +FROM builder as test-builder -ARG DEBIAN_FRONTEND=noninteractive +# WORKDIR /iverilog +RUN make check -RUN apt-get -y update && \ - apt-get install -y \ - make && \ - rm -rf /var/lib/apt/lists/* +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 diff --git a/Dockerfile.ubuntu1804 b/Dockerfile.ubuntu1804 new file mode 100644 index 0000000000..d3f1103505 --- /dev/null +++ b/Dockerfile.ubuntu1804 @@ -0,0 +1,84 @@ +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 From 990e3f61fe5496b5b5469649cef8de93fa845ecd Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Sat, 3 Oct 2020 14:53:20 -0700 Subject: [PATCH 03/10] Updated Dockerfiles to run regression tests during build. --- Dockerfile | 53 ++++++++++++++++++++++++---------------- Dockerfile.ubuntu1804 | 56 ++++++++++++++++++++++++++----------------- 2 files changed, 66 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index 947a688373..9d4526060c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,13 +37,14 @@ RUN sh autoconf.sh && \ FROM builder as test-builder -# WORKDIR /iverilog RUN make check -FROM base as release-candidate +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 @@ -56,19 +57,34 @@ ENTRYPOINT [ "make" ] # 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 +# 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 apk add --no-cache \ + musl \ + 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 @@ -76,11 +92,6 @@ 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 +# docker build --target iverilog-make . -t iverilog-make \ No newline at end of file diff --git a/Dockerfile.ubuntu1804 b/Dockerfile.ubuntu1804 index d3f1103505..396f9d59b0 100644 --- a/Dockerfile.ubuntu1804 +++ b/Dockerfile.ubuntu1804 @@ -35,13 +35,14 @@ RUN bash autoconf.sh && \ FROM builder as test-builder -# WORKDIR /iverilog RUN make check -FROM base as release-candidate +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 @@ -54,19 +55,34 @@ ENTRYPOINT [ "make" ] # 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 +# 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 @@ -74,11 +90,7 @@ 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 +# docker build -f Dockerfile.ubuntu1804 . -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 +# docker build -f Dockerfile.ubuntu1804 --target iverilog-make . -t iverilog-make + From 0e35a971cebd33368c58401ae0427c2a395c7521 Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Sat, 3 Oct 2020 15:16:56 -0700 Subject: [PATCH 04/10] Removed github actions test step, as docker build runs tests. --- .github/workflows/docker-publish.yml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index f5319dce3c..be936ac6bd 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -5,6 +5,7 @@ on: # Publish `master` as Docker `latest` image. branches: - master + - Dockerfile-with-github-actions # Publish `v1.2.3` tags as releases. tags: @@ -18,29 +19,9 @@ env: IMAGE_NAME: iverilog jobs: - # Run tests. - # See also https://docs.docker.com/docker-hub/builds/automated-testing/ - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Run tests - run: | - if [ -f docker-compose.test.yml ]; then - docker-compose --file docker-compose.test.yml build - docker-compose --file docker-compose.test.yml run sut - else - docker build --build-arg GITHUB_WORKSPACE=$GITHUB_WORKSPACE . --file Dockerfile - fi - # Push image to GitHub Packages. # See also https://docs.docker.com/docker-hub/builds/ push: - # Ensure test job passes before pushing image. - needs: test - runs-on: ubuntu-latest if: github.event_name == 'push' From 20f4566a67a95b52dc6cadf8e9652537c158c0d4 Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Sat, 3 Oct 2020 16:50:21 -0700 Subject: [PATCH 05/10] Github action to build and publish iverilog-make with make as the entrypoint. --- .github/workflows/docker-publish.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index be936ac6bd..00e55bc27f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -17,6 +17,7 @@ on: env: # TODO: Change variable to your image's name. IMAGE_NAME: iverilog + IMAGE_NAME_MAKE: iverilog-make jobs: # Push image to GitHub Packages. @@ -31,15 +32,20 @@ jobs: - name: Build image run: docker build --build-arg GITHUB_WORKSPACE=$GITHUB_WORKSPACE . --file Dockerfile --tag $IMAGE_NAME + - name: Build image with entrypoint make + run: docker build --build-arg GITHUB_WORKSPACE=$GITHUB_WORKSPACE --target iverilog-make . --file Dockerfile --tag $IMAGE_NAME_MAKE + - name: Log into registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin - - name: Push image + - name: Push images run: | IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME + IMAGE_ID_MAKE=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME_MAKE # Change all uppercase to lowercase IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + IMAGE_ID_MAKE=$(echo $IMAGE_ID_MAKE | tr '[A-Z]' '[a-z]') # Strip git ref prefix from version VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') @@ -55,3 +61,6 @@ jobs: docker tag $IMAGE_NAME $IMAGE_ID:$VERSION docker push $IMAGE_ID:$VERSION + + docker tag $IMAGE_ID_MAKE $IMAGE_ID_MAKE:$VERSION + docker push $IMAGE_ID_MAKE:$VERSION From 83d2e413a4de7b02ff02a19fb7833b81f014e17f Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Sat, 3 Oct 2020 17:09:27 -0700 Subject: [PATCH 06/10] Github action to build and publish iverilog-make with make as the entrypoint. --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 00e55bc27f..e1f2d1c3e6 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -62,5 +62,5 @@ jobs: docker tag $IMAGE_NAME $IMAGE_ID:$VERSION docker push $IMAGE_ID:$VERSION - docker tag $IMAGE_ID_MAKE $IMAGE_ID_MAKE:$VERSION + docker tag $IMAGE_NAME_MAKE $IMAGE_ID_MAKE:$VERSION docker push $IMAGE_ID_MAKE:$VERSION From 89790be4dafa697804d43fae35bff08a13bb7315 Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Wed, 7 Oct 2020 10:37:33 -0700 Subject: [PATCH 07/10] Simplified Dockerfile, removing entrypoint make. --- .github/workflows/docker-publish.yml | 9 ---- Dockerfile | 69 +++++++++++----------------- 2 files changed, 28 insertions(+), 50 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index e1f2d1c3e6..48b43900f4 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -17,7 +17,6 @@ on: env: # TODO: Change variable to your image's name. IMAGE_NAME: iverilog - IMAGE_NAME_MAKE: iverilog-make jobs: # Push image to GitHub Packages. @@ -32,20 +31,15 @@ jobs: - name: Build image run: docker build --build-arg GITHUB_WORKSPACE=$GITHUB_WORKSPACE . --file Dockerfile --tag $IMAGE_NAME - - name: Build image with entrypoint make - run: docker build --build-arg GITHUB_WORKSPACE=$GITHUB_WORKSPACE --target iverilog-make . --file Dockerfile --tag $IMAGE_NAME_MAKE - - name: Log into registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin - name: Push images run: | IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME - IMAGE_ID_MAKE=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME_MAKE # Change all uppercase to lowercase IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - IMAGE_ID_MAKE=$(echo $IMAGE_ID_MAKE | tr '[A-Z]' '[a-z]') # Strip git ref prefix from version VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') @@ -61,6 +55,3 @@ jobs: docker tag $IMAGE_NAME $IMAGE_ID:$VERSION docker push $IMAGE_ID:$VERSION - - docker tag $IMAGE_NAME_MAKE $IMAGE_ID_MAKE:$VERSION - docker push $IMAGE_ID_MAKE:$VERSION diff --git a/Dockerfile b/Dockerfile index 9d4526060c..4da0d4c567 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,6 @@ RUN apk add --no-cache \ libgcc \ libhistory \ libstdc++ \ - make \ readline \ zlib @@ -35,63 +34,51 @@ RUN sh autoconf.sh && \ make && \ make install -FROM builder as test-builder +FROM builder as builder-iverilog-regression-test 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 +# 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 -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 test-release-candidate as test-release-candidate-perl +FROM release-candidate as iverilog-vpi RUN apk add --no-cache \ - musl \ - perl + build-base -RUN adduser --disabled-password ic -USER ic -WORKDIR /home/ic +FROM iverilog-vpi as test-iverilog-vpi -COPY --from=builder-iverilog-regression-test-base /ivtest /home/ic/ +RUN apk add --no-cache \ + perl -RUN perl vvp_reg.pl -# RUN perl vpi_reg.pl -# RUN perl vhdl_reg.pl +COPY --from=builder-iverilog-regression-test /ivtest /ivtest -FROM release-candidate-entrypoint-make as iverilog-make +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 87.5 MB image which does not contain perl or c/c++ # docker build . -t iverilog # -# docker build --target iverilog-make . -t iverilog-make \ No newline at end of file +# This is a larger 298 MB image with c/c++ compilers through build-base +# docker build --target iverilog-vpi . -t iverilog-vpi +# +# This is a larger 343 MB image with c/c++ compilers throubh build-base and perl +# docker build --target test-iverilog-vpi . -t iverilog-perl +# +# This is a larger 598 MB image with full featured compiler, git, and full build results +# docker build --target builder . -t iverilog-builder \ No newline at end of file From aca42633d5faa519a87c042f13af912b65bc48b3 Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Fri, 6 Nov 2020 13:15:00 -0800 Subject: [PATCH 08/10] Update Dockerfile.ubuntu1804 to build and test iverilog. --- Dockerfile.ubuntu1804 | 83 ++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/Dockerfile.ubuntu1804 b/Dockerfile.ubuntu1804 index 396f9d59b0..b122650c5b 100644 --- a/Dockerfile.ubuntu1804 +++ b/Dockerfile.ubuntu1804 @@ -33,64 +33,67 @@ RUN bash autoconf.sh && \ make && \ make install -FROM builder as test-builder +FROM builder as builder-iverilog-regression-test 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" ] +ARG REGRESSION_TEST_URL=https://github.com/steveicarus/ivtest.git +RUN git clone ${REGRESSION_TEST_URL} ivtest -# 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: +# 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 builder as builder-iverilog-regression-test-base +FROM base as release-candidate -ARG REGRESSION_TEST_URL=https://github.com/steveicarus/ivtest.git -RUN git clone ${REGRESSION_TEST_URL} ivtest +COPY --from=builder /usr/local /usr/local/ -FROM builder-iverilog-regression-test-base as builder-iverilog-regression-test +FROM release-candidate as iverilog-vpi -WORKDIR ivtest -RUN perl vvp_reg.pl -RUN perl vpi_reg.pl +RUN apt-get update && \ + apt-get install -y \ + build-essential -FROM test-release-candidate as test-release-candidate-perl +FROM iverilog-vpi as test-iverilog-vpi 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/ +COPY --from=builder-iverilog-regression-test /ivtest /ivtest +WORKDIR /ivtest RUN perl vvp_reg.pl -# RUN perl vpi_reg.pl -# RUN perl vhdl_reg.pl - -FROM release-candidate-entrypoint-make as iverilog-make +RUN perl vpi_reg.pl FROM release-candidate as iverilog - +# # Below are some sample commands to build docker images. # -# docker build -f Dockerfile.ubuntu1804 . -t iverilog +# 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 # -# docker build -f Dockerfile.ubuntu1804 --target iverilog-make . -t iverilog-make - +# 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 121 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 364 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 382 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 665 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 \ No newline at end of file From dccd4cde63c161731bc67fa664277570cbc11133 Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Fri, 6 Nov 2020 13:16:35 -0800 Subject: [PATCH 09/10] Update comments, build instructions. --- Dockerfile.ubuntu1804 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile.ubuntu1804 b/Dockerfile.ubuntu1804 index b122650c5b..d7002a96ff 100644 --- a/Dockerfile.ubuntu1804 +++ b/Dockerfile.ubuntu1804 @@ -86,14 +86,14 @@ FROM release-candidate as iverilog # # Below are some sample commands to build using ubuntu:20.04 as a base image # -# The vpi_reg.pl script wont run in this 121 MB image which does not contain perl or c/c++ +# 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 364 MB image with c/c++ compilers through build-essential +# 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 382 MB image with c/c++ compilers throubh build-essential and perl +# 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 665 MB image with full featured compiler, git, and full build results +# 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 \ No newline at end of file From b9448bc8bd89212669818669323ad6d97eed048a Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Fri, 6 Nov 2020 13:17:56 -0800 Subject: [PATCH 10/10] Renamed to Dockerfile.ubuntu. --- Dockerfile.ubuntu1804 => Dockerfile.ubuntu | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Dockerfile.ubuntu1804 => Dockerfile.ubuntu (100%) diff --git a/Dockerfile.ubuntu1804 b/Dockerfile.ubuntu similarity index 100% rename from Dockerfile.ubuntu1804 rename to Dockerfile.ubuntu