Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the Dockerfile for stable, Ubuntu 16.04-based builds #452

Merged
merged 3 commits into from
Apr 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/.git
**/.gitmodules
**/.travis.yml
**/Dockerfile
**/*.md

docs
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
- docker

install:
- docker build -t p4c .
- docker build -t p4c --build-arg IMAGE_TYPE=test .

script:
- docker run -w /p4c/build p4c make check VERBOSE=1
Expand Down
24 changes: 21 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
FROM p4lang/behavioral-model:latest
MAINTAINER Seth Fowler <seth.fowler@barefootnetworks.com>

# Select the type of image we're building. Use `build` for a normal build, which
# is optimized for image size. Use `test` if this image will be used for
# testing; in this case, the source code and build-only dependencies will not be
# removed from the image.
ARG IMAGE_TYPE=build

ENV P4C_DEPS automake \
bison \
build-essential \
Expand All @@ -11,14 +17,26 @@ ENV P4C_DEPS automake \
libgmp-dev \
libtool \
pkg-config \
python \
python-ipaddr \
python-scapy \
tcpdump
ENV P4C_RUNTIME_DEPS cpp \
libgc1c2 \
libgmp10 \
libgmpxx4ldbl \
python
COPY . /p4c/
WORKDIR /p4c/
RUN apt-get update && \
apt-get install -y --no-install-recommends $P4C_DEPS && \
apt-get install -y --no-install-recommends $P4C_DEPS $P4C_RUNTIME_DEPS && \
./bootstrap.sh && \
cd build && \
make
make && \
make install && \
(test "$IMAGE_TYPE" = "build" && \
apt-get purge -y $P4C_DEPS && \
apt-get autoremove --purge -y && \
rm -rf /p4c /var/cache/apt/* /var/lib/apt/lists/* && \
echo 'Build image ready') || \
(test "$IMAGE_TYPE" = "test" && \
echo 'Test image ready')