This repository was archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 681
Containerized weave build #387
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2323385
Support non-containerized WEAVETOOLS_EXES build
dpw a31b115
Add 'build' makefile target
dpw 3c093d7
Make build.sh show its progress
dpw 949afd9
Add some sudos to make tools/build.sh work when not root
dpw b1ac63c
A Dockerfile to facilitate building in a container
dpw cd06a29
Update build docs
dpw 4ea67bb
Elaborate comments
dpw d23df19
reword
rade 438e578
Leave the docker image .tar files in the weave directory
dpw cf2b7bc
Remove 'make prerequisites' and update docs accordingly
dpw a869e89
Fix incorrect markdown link syntax
dpw 3d5e76d
Always use sudo for docker commands in instructions
dpw f46746c
Fix a mention of the exported images being in /var/tmp
dpw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM ubuntu | ||
|
||
8000 td> | # When doing a build in a container, "apt-get update" happens twice, | |
# which can be a very significant overhead for incremental builds. | ||
# And it's unnecessary, because if any of the prerequisites do change, | ||
# the right thing to do is to rebuild the container image. Rather | ||
# than suppressing the "apt-get update" commands explicitly, we clear | ||
# out sources.list so that 'apt-get update' doesn't do anything. | ||
|
||
RUN sh -c 'apt-get -y update && apt-get -y install --no-install-recommends build-essential git ca-certificates golang docker.io mercurial libpcap-dev curl make pkg-config gcc bison flex && echo >/etc/apt/sources.list' | ||
COPY build.sh / | ||
ENTRYPOINT ["sh", "/build.sh"] |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
GOPATH=/home/go | ||
export GOPATH | ||
|
||
WEAVE_SRC=$GOPATH/src/github.com/zettio/weave | ||
|
||
if [ $# -eq 0 ] ; then | ||
# No arguments. Expect that the weave repo will be bind-mounted | ||
# into $GOPATH | ||
if ! [ -e $WEAVE_SRC ] ; then | ||
cat 2>&1 <<EOF | ||
No container arguments supplied, and nothing at ${WEAVE_SRC}. Please | ||
either bind-mount the golang workspace containing weave with the | ||
docker run -v option, e.g.: | ||
|
||
$ docker run -v <host gopath>:${GOPATH} \\ | ||
-v /var/run/docker.sock:/var/run/docker.sock zettio/weave-build | ||
|
||
Or supply git clone arguments to retrieve it, e.g.: | ||
|
||
$ docker run -v /var/run/docker.sock:/var/run/docker.sock \\ | ||
zettio/weave-build https://github.com/zettio/weave.git | ||
EOF | ||
exit 1 | ||
fi | ||
|
||
# If we run make directly, any files created on the bind mount | ||
# will have awkward ownership. So we switch to a user with the | ||
# same user and group IDs as source directory. We have to set a | ||
# few things up so that sudo works without complaining later on. | ||
uid=$(stat --format="%u" $WEAVE_SRC) | ||
gid=$(stat --format="%g" $WEAVE_SRC) | ||
echo "weave:x:$uid:$gid::$WEAVE_SRC:/bin/sh" >>/etc/passwd | ||
echo "weave:*:::::::" >>/etc/shadow | ||
echo "weave ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers | ||
su weave -c "make -C $WEAVE_SRC build" | ||
else | ||
# There are arguments to pass to git-clone | ||
mkdir -p ${WEAVE_SRC%/*} | ||
git clone "$@" $WEAVE_SRC | ||
make -C $WEAVE_SRC build | ||
fi |
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as abuse.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as abuse.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as abuse.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.