Skip to content

Commit

Permalink
make libvirt optional (docker-archive#718)
Browse files Browse the repository at this point in the history
Signed-off-by: David Chung <[email protected]>
  • Loading branch information
David Chung authored Oct 10, 2017
1 parent 0755e99 commit 79c9cbe
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ E2E_TESTS?=true
#Source file target
SRCS := $(shell find . -type f -name '*.go')

# Set the go build tags here. By default we disable building of libvirt
GO_BUILD_TAGS?=nolibvirt

# Allow turning off function inlining and variable registerization
ifeq (${DISABLE_OPTIMIZATION},true)
GO_GCFLAGS=-gcflags "-N -l"
Expand Down Expand Up @@ -88,7 +91,7 @@ clean:

define binary_target_template
build/$(1): $(SRCS)
go build -o build/$(1)$(EXE_EXT) \
go build -o build/$(1)$(EXE_EXT) -tags $(GO_BUILD_TAGS) \
-ldflags "-X github.com/docker/infrakit/pkg/cli.Version=$(VERSION) -X github.com/docker/infrakit/pkg/cli.Revision=$(REVISION) -X github.com/docker/infrakit/pkg/util/docker.ClientVersion=$(DOCKER_CLIENT_VERSION)" $(2)
endef
define define_binary_target
Expand Down
7 changes: 7 additions & 0 deletions cmd/infrakit/libvirt.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build libvirt

package main

import (
_ "github.com/docker/infrakit/pkg/run/v0/libvirt"
)
1 change: 0 additions & 1 deletion cmd/infrakit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import (
_ "github.com/docker/infrakit/pkg/run/v0/image"
_ "github.com/docker/infrakit/pkg/run/v0/ingress"
_ "github.com/docker/infrakit/pkg/run/v0/kubernetes"
_ "github.com/docker/infrakit/pkg/run/v0/libvirt"
_ "github.com/docker/infrakit/pkg/run/v0/maas"
_ "github.com/docker/infrakit/pkg/run/v0/manager"
_ "github.com/docker/infrakit/pkg/run/v0/oracle"
Expand Down
2 changes: 2 additions & 0 deletions cmd/infrakit/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ func Command(plugins func() discovery.Plugins) *cobra.Command {

parsedRules := []launch.Rule{}

log.Info("config", "url", *configURL)

if *configURL != "" {
buff, err := processTemplate(*configURL)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/Dockerfile.installer
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM golang:1.8-alpine

RUN apk add --update git make gcc musl-dev wget ca-certificates openssl libvirt-dev git openssh
RUN apk add --update git make gcc musl-dev wget ca-certificates openssl libvirt-dev libvirt-lxc libvirt-qemu git openssh

ENV GOPATH /go
ENV PATH /go/bin:$PATH

COPY dockerfiles/build-infrakit /usr/local/bin/
COPY dockerfiles/build-hyperkit /usr/local/bin/

# Add source code
Add . /go/src/github.com/docker/infrakit/
4 changes: 2 additions & 2 deletions docs/install
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Installs infrakit by cross compiling locally inside a docker container.

if [[ "$(which docker)" == "" ]]; then
if [ "$(which docker)" = "" ]; then
echo "You must have Docker locally."
exit -1
fi
Expand All @@ -22,5 +22,5 @@ case "$(uname)" in
esac


docker run --rm -v $dir:/build infrakit/installer build-infrakit $target
docker run --rm -v $dir:/build infrakit/installer:latest build-infrakit $target
sudo cp ./infrakit /usr/local/bin

0 comments on commit 79c9cbe

Please sign in to comment.