Skip to content

Commit 0c15954

Browse files
author
Matthew Fisher
committed
Merge pull request #3684 from bacongobbler/builder-overhaul
ref(builder): organize for docker best practices
2 parents b09b511 + e96f5f2 commit 0c15954

42 files changed

Lines changed: 24 additions & 42 deletions

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,7 @@ controller/.secret_key
2222
logs/
2323

2424
# local binaries, installers, and artifacts
25-
builder/Godeps/
26-
builder/image/bin/extract-domain
27-
builder/image/bin/extract-types
28-
builder/image/bin/extract-version
29-
builder/image/bin/generate-buildhook
30-
builder/image/bin/get-app-config
31-
builder/image/bin/get-app-values
32-
builder/image/bin/publish-release-controller
33-
builder/image/bin/yaml2json-procfile
25+
builder/rootfs/usr/bin
3426
cache/image/bin/
3527
client/dist/
3628
client/makeself/

builder/.dockerignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

builder/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ include ../includes.mk
44
repo_path = github.com/deis/deis/builder
55

66
GO_FILES = types.go utils.go utils_test.go
7-
GO_PACKAGES = bin tests
7+
GO_PACKAGES = src tests
88
GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES))
99

1010
COMPONENT = $(notdir $(repo_path))
1111
IMAGE = $(IMAGE_PREFIX)$(COMPONENT):$(BUILD_TAG)
1212
DEV_IMAGE = $(DEV_REGISTRY)/$(IMAGE)
1313
BINARIES := extract-domain extract-types extract-version generate-buildhook get-app-config get-app-values publish-release-controller yaml2json-procfile
14-
BINARY_DEST_DIR := image/bin
14+
BINARY_DEST_DIR := rootfs/usr/bin
1515

1616
build: check-docker
1717
for i in $(BINARIES); do \
18-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/$$i bin/$$i.go || exit 1; \
18+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/$$i src/$$i.go || exit 1; \
1919
$(call check-static-binary,$(BINARY_DEST_DIR)/$$i) \
2020
done
21-
docker build -t $(IMAGE) image
21+
docker build -t $(IMAGE) rootfs
2222

2323
clean: check-docker check-registry
2424
for i in $(BINARIES); do \
@@ -66,7 +66,7 @@ test-unit:
6666

6767
test-functional:
6868
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest
69-
GOPATH=`cd ../tests/ && godep path`:$(GOPATH) go test -v ./tests/...
69+
godep go test -v ./tests/...
7070

7171
test-style:
7272
# display output, then check
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ RUN chown -R $GITUSER:$GITUSER $GITHOME
4444
# use VOLUME to remove /var/lib/docker from copy-on-write for performance
4545
# we don't want to stack overlay filesystems
4646
VOLUME /var/lib/docker
47-
WORKDIR /app
48-
ENTRYPOINT ["/app/bin/entry"]
49-
CMD ["/app/bin/boot"]
47+
48+
ENTRYPOINT ["/bin/entry"]
49+
CMD ["/bin/boot"]
5050
EXPOSE 22
5151
RUN addgroup -g 2000 slug && adduser -D -u 2000 -G slug slug
5252

@@ -57,9 +57,6 @@ RUN addgroup $GITUSER docker
5757
RUN addgroup $GITUSER slug
5858
RUN passwd -u git
5959

60-
ADD templates/shim.dockerfile /home/git/
61-
ADD etc /etc
62-
ADD . /app
63-
RUN chown -R root:root /app
60+
COPY . /
6461

6562
ENV DEIS_RELEASE 1.7.0-dev
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ function etcd_safe_mkdir {
4141
etcd_safe_mkdir $ETCD_PATH/users
4242

4343
# wait for confd to run once and install initial templates
44-
until confd -onetime -node $ETCD --confdir /app --log-level error; do
44+
until confd -onetime -node $ETCD --log-level error; do
4545
echo "builder: waiting for confd to write initial templates..."
4646
sleep $(($ETCD_TTL/2)) # sleep for half the TTL
4747
done
4848

4949
# spawn confd in the background to update services based on etcd changes
50-
confd -node $ETCD --confdir /app --log-level error --interval 5 &
50+
confd -node $ETCD --log-level error --interval 5 &
5151
CONFD_PID=$!
5252

5353
# remove any pre-existing docker.sock
@@ -60,10 +60,6 @@ if [[ "$fstype" == "overlay" ]]; then
6060
DRIVER_OVERRIDE="--storage-driver=overlay"
6161
fi
6262

63-
# cheat
64-
cp /app/bin/apparmor_parser /sbin/apparmor_parser
65-
cp /app/bin/auplink /sbin/auplink
66-
6763
# spawn a docker daemon to run builds
6864
docker -d --bip=172.19.42.1/16 $DRIVER_OVERRIDE --insecure-registry 10.0.0.0/8 --insecure-registry 172.16.0.0/12 --insecure-registry 192.168.0.0/16 --insecure-registry 100.64.0.0/10 &
6965
DOCKER_PID=$!
@@ -74,8 +70,8 @@ while [[ ! -e /var/run/docker.sock ]]; do
7470
done
7571

7672
# build required images
77-
docker build -t deis/slugbuilder /app/slugbuilder/
78-
docker build -t deis/slugrunner /app/slugrunner/
73+
docker build -t deis/slugbuilder /usr/local/src/slugbuilder/
74+
docker build -t deis/slugrunner /usr/local/src/slugrunner/
7975

8076
# start an SSH daemon to process `git push` requests
8177
/usr/sbin/sshd -D -e &
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)