| 1 |
# This file describes the standard way to build Docker, using docker |
| 2 |
# |
| 3 |
# Usage: |
| 4 |
# |
| 5 |
# # Assemble the full dev environment. This is slow the first time. |
| 6 |
# docker build -t docker . |
| 7 |
# |
| 8 |
# # Mount your source in an interactive container for quick testing: |
| 9 |
# docker run -v `pwd`:/go/src/github.com/docker/docker --privileged -i -t docker bash |
| 10 |
# |
| 11 |
# # Run the test suite: |
| 12 |
# docker run --privileged docker hack/make.sh test-unit test-integration-cli test-docker-py |
| 13 |
# |
| 14 |
# # Publish a release: |
| 15 |
# docker run --privileged \ |
| 16 |
# -e AWS_S3_BUCKET=baz \ |
| 17 |
# -e AWS_ACCESS_KEY=foo \ |
| 18 |
# -e AWS_SECRET_KEY=bar \ |
| 19 |
# -e GPG_PASSPHRASE=gloubiboulga \ |
| 20 |
# docker hack/release.sh |
| 21 |
# |
| 22 |
# Note: AppArmor used to mess with privileged mode, but this is no longer |
| 23 |
# the case. Therefore, you don't have to disable it anymore. |
| 24 |
# |
| 25 |
|
| 26 |
FROM ubuntu:14.04 |
| 27 |
LABEL maintainer Tianon Gravi <[email protected]> (@tianon) |
| 28 |
|
| 29 |
# Packaged dependencies |
| 30 |
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq \ |
| 31 |
apt-utils \ |
| 32 |
aufs-tools \ |
| 33 |
automake \ |
| 34 |
btrfs-tools \ |
| 35 |
build-essential \ |
| 36 |
curl \ |
| 37 |
dpkg-sig \ |
| 38 |
git \ |
| 39 |
iptables \ |
| 40 |
libapparmor-dev \ |
| 41 |
libcap-dev \ |
| 42 |
mercurial \ |
| 43 |
pandoc \ |
| 44 |
parallel \ |
| 45 |
reprepro \ |
| 46 |
ruby1.9.1 \ |
| 47 |
ruby1.9.1-dev \ |
| 48 |
s3cmd=1.1.0* \ |
| 49 |
--no-install-recommends |
| 50 |
|
| 51 |
# Get lvm2 source for compiling statically |
| 52 |
RUN git clone --no-checkout https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2 && cd /usr/local/lvm2 && git checkout -q v2_02_103 |
| 53 |
# see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags |
| 54 |
# note: we don't use "git clone -b" above because it then spews big nasty warnings about 'detached HEAD' state that we can't silence as easily as we can silence them using "git checkout" directly |
| 55 |
|
| 56 |
# Compile and install lvm2 |
| 57 |
RUN cd /usr/local/lvm2 && ./configure --enable-static_link && make device-mapper && make install_device-mapper |
| 58 |
# see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL |
| 59 |
|
| 60 |
# Install Go |
| 61 |
RUN curl -sSL https://golang.org/dl/go1.3.src.tar.gz | tar -v -C /usr/local -xz |
| 62 |
ENV PATH /usr/local/go/bin:$PATH |
| 63 |
ENV GOPATH /go:/go/src/github.com/docker/docker/vendor |
| 64 |
RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1 |
| 65 |
|
| 66 |
# Compile Go for cross compilation |
| 67 |
ENV DOCKER_CROSSPLATFORMS \ |
| 68 |
linux/386 linux/arm \ |
| 69 |
darwin/amd64 darwin/386 \ |
| 70 |
freebsd/amd64 freebsd/386 freebsd/arm |
| 71 |
# (set an explicit GOARM of 5 for maximum compatibility) |
| 72 |
ENV GOARM 5 |
| 73 |
RUN cd /usr/local/go/src && bash -xc 'for platform in $DOCKER_CROSSPLATFORMS; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean 2>&1; done' |
| 74 |
|
| 75 |
# Grab Go's cover tool for dead-simple code coverage testing |
| 76 |
RUN go get golang.org/x/tools/cmd/cover |
| 77 |
|
| 78 |
# TODO replace FPM with some very minimal debhelper stuff |
| 79 |
RUN gem install --no-rdoc --no-ri fpm --version 1.0.2 |
| 80 |
|
| 81 |
# Get the "busybox" image source so we can build locally instead of pulling |
| 82 |
RUN git clone -b buildroot-2014.02 https://github.com/jpetazzo/docker-busybox.git /docker-busybox |
| 83 |
|
| 84 |
# Setup s3cmd config |
| 85 |
RUN /bin/echo -e '[default]\naccess_key=$AWS_ACCESS_KEY\nsecret_key=$AWS_SECRET_KEY' > /.s3cfg |
| 86 |
|
| 87 |
# Set user.email so crosbymichael's in-container merge commits go smoothly |
| 88 |
RUN git config --global user.email '[email protected]' |
| 89 |
|
| 90 |
# Add an unprivileged user to be used for tests which need it |
| 91 |
RUN groupadd -r docker |
| 92 |
RUN useradd --create-home --gid docker unprivilegeduser |
| 93 |
|
| 94 |
VOLUME /var/lib/docker |
| 95 |
WORKDIR /go/src/github.com/docker/docker |
| 96 |
ENV DOCKER_BUILDTAGS apparmor selinux |
| 97 |
|
| 98 |
# Wrap all commands in the "docker-in-docker" script to allow nested containers |
| 99 |
ENTRYPOINT ["hack/dind"] |
| 100 |
|
| 101 |
# Upload docker source |
| 102 |
COPY . /go/src/github.com/docker/docker |