Skip to content

Commit d7bfaef

Browse files
author
Matthew Fisher
committed
ref(builder): move builder to image/, add unit tests
This move refactors some parts of the builder to go, as well as allowing the possibility of re-writing the entire component in Go in the future.
1 parent 282d485 commit d7bfaef

69 files changed

Lines changed: 11481 additions & 336 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

builder/Dockerfile

Lines changed: 14 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,19 @@
1-
FROM ubuntu-debootstrap:14.04
1+
FROM golang:1.3
22

3-
ENV DEBIAN_FRONTEND noninteractive
3+
# install dependencies
4+
RUN go get github.com/tools/godep
45

5-
# install common packages
6-
RUN apt-get update && apt-get install -y curl net-tools sudo
6+
RUN mkdir -p /go/bin
77

8-
# install etcdctl
9-
RUN curl -sSL -o /usr/local/bin/etcdctl https://s3-us-west-2.amazonaws.com/opdemand/etcdctl-v0.4.6 \
10-
&& chmod +x /usr/local/bin/etcdctl
8+
COPY . /go/src/github.com/deis/deis/builder
119

12-
# install confd
13-
RUN curl -sSL -o /usr/local/bin/confd https://s3-us-west-2.amazonaws.com/opdemand/confd-v0.5.0-json \
14-
&& chmod +x /usr/local/bin/confd
10+
WORKDIR /go/src/github.com/deis/deis/builder
1511

16-
# install docker-in-docker
17-
RUN echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
18-
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
19-
20-
# install builder, docker, and hook dependencies
21-
RUN apt-get update && apt-get install -yq \
22-
openssh-server git \
23-
aufs-tools iptables lxc \
24-
lxc-docker-1.3.2
25-
26-
# configure ssh server
27-
RUN rm /etc/ssh/ssh_host_*
28-
RUN dpkg-reconfigure openssh-server
29-
RUN mkdir -p /var/run/sshd
30-
31-
# configure locale
32-
RUN echo LANG="en_US.UTF-8" > /etc/default/locale && dpkg-reconfigure locales
33-
34-
# install git and configure gituser
35-
ENV GITHOME /home/git
36-
ENV GITUSER git
37-
RUN useradd -d $GITHOME $GITUSER
38-
RUN mkdir -p $GITHOME/.ssh && chown git:git $GITHOME/.ssh
39-
RUN chown -R $GITUSER:$GITUSER $GITHOME
40-
41-
# let the git user run `sudo /home/git/builder` (not writeable)
42-
RUN echo "%git ALL=(ALL:ALL) NOPASSWD:/home/git/builder" >> /etc/sudoers
43-
44-
# HACK: import progrium/cedarish as a tarball
45-
# see https://github.com/deis/deis/issues/1027
46-
RUN curl -#SL -o /progrium_cedarish.tar \
47-
https://s3-us-west-2.amazonaws.com/opdemand/progrium_cedarish_2014_10_01.tar
48-
49-
# define the execution environment
50-
# use VOLUME to remove /var/lib/docker from copy-on-write for performance
51-
# we don't want to stack overlay filesystems
52-
VOLUME /var/lib/docker
53-
WORKDIR /app
54-
ENTRYPOINT ["/app/bin/entry"]
55-
CMD ["/app/bin/boot"]
56-
EXPOSE 22
57-
RUN addgroup --quiet --gid 2000 slug && useradd slug --uid=2000 --gid=2000
58-
59-
ADD templates/shim.dockerfile /home/git/
60-
ADD etc /etc
61-
ADD . /app
62-
RUN chown -R root:root /app
12+
RUN CGO_ENABLED=0 godep go build -a -ldflags '-s' bin/extract-domain.go && mv extract-domain /go/bin/
13+
RUN CGO_ENABLED=0 godep go build -a -ldflags '-s' bin/extract-types.go && mv extract-types /go/bin/
14+
RUN CGO_ENABLED=0 godep go build -a -ldflags '-s' bin/extract-version.go && mv extract-version /go/bin/
15+
RUN CGO_ENABLED=0 godep go build -a -ldflags '-s' bin/generate-buildhook.go && mv generate-buildhook /go/bin/
16+
RUN CGO_ENABLED=0 godep go build -a -ldflags '-s' bin/get-app-config.go && mv get-app-config /go/bin/
17+
RUN CGO_ENABLED=0 godep go build -a -ldflags '-s' bin/get-app-values.go && mv get-app-values /go/bin/
18+
RUN CGO_ENABLED=0 godep go build -a -ldflags '-s' bin/yaml2json-procfile.go && mv yaml2json-procfile /go/bin/
19+
RUN CGO_ENABLED=0 godep go build -a -ldflags '-s' bin/publish-release-controller.go && mv publish-release-controller /go/bin/

builder/Godeps/Godeps.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builder/Godeps/Readme

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builder/Godeps/_workspace/.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builder/Godeps/_workspace/src/gopkg.in/yaml.v2/LICENSE

Lines changed: 188 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builder/Godeps/_workspace/src/gopkg.in/yaml.v2/LICENSE.libyaml

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)