-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dockerfile: add ARG IMAGE, use three stages
- Loading branch information
1138-4EB
committed
Aug 7, 2019
1 parent
3463511
commit 5e2919d
Showing
1 changed file
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,51 @@ | ||
FROM ubuntu:18.04 as builder | ||
LABEL author="Abdelrahman Hosny <[email protected]>" | ||
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 \ | ||
flex \ | ||
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"] |