First cut of Docker build for backend

This commit is contained in:
Peter Bourgon
2015-09-10 15:28:50 +02:00
parent 57aaf4be6f
commit fc95067bd3
4 changed files with 26 additions and 2 deletions

3
.gitignore vendored
View File

@@ -52,4 +52,5 @@ experimental/_integration/_integration
*sublime-project
*sublime-workspace
*npm-debug.log
backend/scope-app
backend/scope-probe

View File

@@ -1,4 +1,4 @@
.PHONY: all deps static clean client-lint client-test client-sync
.PHONY: all deps static clean client-lint client-test client-sync backend
# If you can use Docker without being root, you can `make SUDO= <target>`
SUDO=sudo
@@ -11,6 +11,7 @@ SCOPE_IMAGE=$(DOCKERHUB_USER)/scope
SCOPE_EXPORT=scope.tar
SCOPE_UI_BUILD_EXPORT=scope_ui_build.tar
SCOPE_UI_BUILD_IMAGE=$(DOCKERHUB_USER)/scope-ui-build
SCOPE_BACKEND_BUILD_IMAGE=$(DOCKERHUB_USER)/scope-backend-build
SCOPE_VERSION=$(shell git rev-parse --short HEAD)
DOCKER_VERSION=1.3.1
DOCKER_DISTRIB=docker/docker-$(DOCKER_VERSION).tgz
@@ -76,6 +77,11 @@ $(SCOPE_UI_BUILD_EXPORT): client/Dockerfile client/package.json client/webpack.l
docker build -t $(SCOPE_UI_BUILD_IMAGE) client
docker save $(SCOPE_UI_BUILD_IMAGE):latest > $@
backend:
docker build -t $(SCOPE_BACKEND_BUILD_IMAGE) backend
docker run -ti -v $(shell pwd)/backend:/mount $(SCOPE_BACKEND_BUILD_IMAGE) cp /go/bin/scope-app /mount
docker run -ti -v $(shell pwd)/backend:/mount $(SCOPE_BACKEND_BUILD_IMAGE) cp /go/bin/scope-probe /mount
clean:
go clean ./...
rm -rf $(SCOPE_EXPORT) $(SCOPE_UI_BUILD_EXPORT) $(APP_EXE) $(PROBE_EXE) client/build/app.js

5
backend/Dockerfile Normal file
View File

@@ -0,0 +1,5 @@
FROM golang:1.5.1
RUN apt-get update && apt-get install -y libpcap-dev
COPY build.bash /
RUN /build.bash

12
backend/build.bash Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
mkdir -p /go/src/github.com/weaveworks
cd /go/src/github.com/weaveworks
git clone https://github.com/weaveworks/scope
cd scope
make deps
SUDO= make app/scope-app
mv app/scope-app $GOPATH/bin
SUDO= make probe/scope-probe
mv probe/scope-probe $GOPATH/bin