aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
author1138-4EB <1138-4EB@users.noreply.github.com>2019-07-01 14:50:15 +0200
committer1138-4EB <1138-4EB@users.noreply.github.com>2019-08-07 05:38:09 +0200
commit5e2919de026aab163f05e2b9440a3bf3563ac4fc (patch)
treecada6a32ca0b7772ea3f78e7f2b8d16a1e679977 /Dockerfile
parent34635116014dc178cc7608bc8e1804b294e1a21f (diff)
downloadyosys-5e2919de026aab163f05e2b9440a3bf3563ac4fc.tar.gz
yosys-5e2919de026aab163f05e2b9440a3bf3563ac4fc.tar.bz2
yosys-5e2919de026aab163f05e2b9440a3bf3563ac4fc.zip
dockerfile: add ARG IMAGE, use three stages
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile40
1 files changed, 27 insertions, 13 deletions
diff --git a/Dockerfile b/Dockerfile
index 2e0eba98c..d21f6dc5b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,24 @@
-FROM ubuntu:18.04 as builder
-LABEL author="Abdelrahman Hosny <abdelrahman.hosny@hotmail.com>"
+ARG IMAGE="ubuntu:18.04"
+
+#---
+
+FROM $IMAGE AS base
+
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
ca-certificates \
+ libreadline-dev \
+ tcl-dev \
+ && apt-get autoclean && apt-get clean && apt-get -y autoremove \
+ && update-ca-certificates \
+ && rm -rf /var/lib/apt/lists
+
+#---
+
+FROM base AS build
+
+RUN apt-get update -qq \
+ && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
clang \
bison \
build-essential \
@@ -10,28 +26,26 @@ RUN apt-get update -qq \
gawk \
git \
libffi-dev \
- libreadline-dev \
pkg-config \
python3 \
- tcl-dev \
&& apt-get autoclean && apt-get clean && apt-get -y autoremove \
- && update-ca-certificates \
&& rm -rf /var/lib/apt/lists
COPY . /
+
RUN make \
&& make install \
&& mkdir dist && cp yosys yosys-abc yosys-config yosys-filterlib yosys-smtbmc dist/
-FROM ubuntu:18.04
-RUN apt-get update -qq \
- && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
- libreadline-dev \
- tcl-dev
+#---
+
+FROM base
-COPY --from=builder /dist /build
+COPY --from=build /dist /opt/yosys
+
+ENV PATH /opt/yosys:$PATH
-ENV PATH /build:$PATH
RUN useradd -m yosys
USER yosys
-ENTRYPOINT ["yosys"]
+
+CMD ["yosys"]