Use alpine linux 3.12 as default, ubuntu1804 alternative added.

This commit is contained in:
Thirsty2 2020-10-02 14:39:41 -07:00
parent b97ff24bee
commit b19ed43c8b
2 changed files with 147 additions and 15 deletions

View File

@ -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

84
Dockerfile.ubuntu1804 Normal file
View File

@ -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