Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Debian9 support #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Dockerfile.debian9
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM debian:9

MAINTAINER Daniel Hiltgen <[email protected]>

ARG MACHINE_VERSION
ARG GO_VERSION
ARG PLUGIN_VERSION
ENV GOPATH /go

RUN apt-get update && apt-get install -y libvirt-dev curl git gcc
RUN curl -sSL https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xzf -
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/go/bin
RUN git clone --branch ${MACHINE_VERSION} https://github.com/docker/machine.git /go/src/github.com/docker/machine

COPY . /go/src/github.com/dhiltgen/docker-machine-kvm
WORKDIR /go/src/github.com/dhiltgen/docker-machine-kvm
RUN go get -v -d ./...

RUN go install -v -ldflags="-X main.goVersion=${GO_VERSION} -X main.machineVersion=${MACHINE_VERSION} -X main.pluginVersion=${PLUGIN_VERSION}" ./cmd/docker-machine-driver-kvm
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ MACHINE_VERSION=v0.10.0
GO_VERSION=1.8.1
DESCRIBE=$(shell git describe --tags)

TARGETS=$(addprefix $(PREFIX)-, alpine3.4 alpine3.5 ubuntu14.04 ubuntu16.04 centos7)
TARGETS=$(addprefix $(PREFIX)-, alpine3.4 alpine3.5 ubuntu14.04 ubuntu16.04 centos7 debian9)

build: $(TARGETS)

$(PREFIX)-%: Dockerfile.%
docker rmi -f $@ >/dev/null 2>&1 || true
docker rm -f $@-extract > /dev/null 2>&1 || true
echo "Building binaries for $@"
docker build --build-arg "MACHINE_VERSION=$(MACHINE_VERSION)" --build-arg "GO_VERSION=$(GO_VERSION)" -t $@ -f $< .
docker build --build-arg "MACHINE_VERSION=$(MACHINE_VERSION)" --build-arg "GO_VERSION=$(GO_VERSION)" --build-arg "PLUGIN_VERSION=$(DESCRIBE)" -t $@ -f $< .
docker create --name $@-extract $@ sh
docker cp $@-extract:/go/bin/docker-machine-driver-kvm ./
mv ./docker-machine-driver-kvm ./$@
Expand Down
15 changes: 14 additions & 1 deletion cmd/docker-machine-driver-kvm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@ package main
import (
"github.com/dhiltgen/docker-machine-kvm"
"github.com/docker/machine/libmachine/drivers/plugin"
"flag"
"fmt"
)

// Will be set using "-X" linker option during build
var goVersion = "undefined"
var machineVersion = "undefined"
var pluginVersion = "undefined"

func main() {
plugin.RegisterDriver(kvm.NewDriver("default", "path"))
versionPtr := flag.Bool("version", true, "print version number")
flag.Parse()
if *versionPtr {
fmt.Printf("go: %s\nmachine: %s\nplugin: %s\n", goVersion, machineVersion, pluginVersion)
} else {
plugin.RegisterDriver(kvm.NewDriver("default", "path"))
}
}