Docker plugin build.
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
2023-05-24 23:55:55 +02:00
parent 271bdc6182
commit 2a11d9cb51
7 changed files with 156 additions and 0 deletions

19
.drone.yml Normal file
View File

@@ -0,0 +1,19 @@
kind: pipeline
name: default
steps:
- name: docker
#image: plugins/docker
image: git.ivasoft.cz/sw/drone-docker
settings:
registry: https://git.ivasoft.cz
username:
from_secret: repo_user
password:
from_secret: repo_pass
repo: git.ivasoft.cz/sw/docker-bridge-overlay
is_plugin: true
#debug: true
tags:
- latest
- ${DRONE_TAG:-latest}

19
Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM golang:1.20-alpine3.17 AS builder
WORKDIR /usr/local/src/docker-bridge-overlay
COPY go.* ./
RUN go mod download
COPY cmd/ ./cmd/
COPY pkg/ ./pkg/
RUN mkdir bin/ && go build -o bin/ ./cmd/...
FROM alpine:3.17
RUN mkdir -p /run/docker/plugins
COPY --from=builder /usr/local/src/docker-bridge-overlay/bin/bridge-overlay /usr/sbin/
COPY config.json /
ENTRYPOINT ["/usr/sbin/bridge-overlay"]

55
Makefile Normal file
View File

@@ -0,0 +1,55 @@
PLUGIN_NAME = git.ivasoft.cz/sw/docker-bridge-overlay
PLUGIN_TAG ?= golang
PLATFORMS ?= linux/amd64,linux/arm64
SOURCES = $(shell find pkg/ cmd/ -name '*.go')
BINARY = bin/net-dhcp
.PHONY: all debug build create enable disable pdebug push clean
all: create enable
bin/%: $(SOURCES)
go build -o $@ ./cmd/$(shell basename $@)
debug: $(BINARY)
sudo $< -log debug
build: $(SOURCES)
docker build -t $(PLUGIN_NAME):rootfs .
plugin/rootfs: build
mkdir -p plugin/rootfs
docker create --name tmp $(PLUGIN_NAME):rootfs
docker export tmp | tar xC plugin/rootfs
docker rm -vf tmp
plugin: plugin/rootfs config.json
cp config.json $@/
create: plugin
docker plugin rm -f $(PLUGIN_NAME):$(PLUGIN_TAG) || true
docker plugin create $(PLUGIN_NAME):$(PLUGIN_TAG) $<
docker plugin set $(PLUGIN_NAME):$(PLUGIN_TAG) LOG_LEVEL=trace
enable: plugin
docker plugin enable $(PLUGIN_NAME):$(PLUGIN_TAG)
disable:
docker plugin disable $(PLUGIN_NAME):$(PLUGIN_TAG)
pdebug: create enable
sudo sh -c 'tail -f /var/lib/docker/plugins/*/rootfs/var/log/bridge-overlay.log'
push: create
docker plugin push $(PLUGIN_NAME):$(PLUGIN_TAG)
multiarch: $(SOURCES)
docker buildx build --platform=$(PLATFORMS) -o type=local,dest=$@ .
push-multiarch: multiarch config.json
scripts/push_multiarch_plugin.py -p $(PLATFORMS) config.json multiarch $(PLUGIN_NAME):$(PLUGIN_TAG)
clean:
-rm -rf multiarch/
-rm -rf plugin/
-rm bin/*

BIN
bin/mount.objectivefs Normal file

Binary file not shown.

31
config.json Normal file
View File

@@ -0,0 +1,31 @@
{
"description": "Docker bridge as overlay networking driver",
"interface": {
"socket": "bridge-overlay.sock",
"types": [
"docker.networkdriver/1.0"
]
},
"entrypoint": ["/usr/sbin/bridge-overlay", "-logfile", "/var/log/bridge-overlay.log"],
"env": [
{
"description": "Log level",
"name": "LOG_LEVEL",
"value": "info",
"settable": [
"value"
]
}
],
"workdir": "/",
"mounts": [
{
"source": "/var/run/docker.sock",
"destination": "/run/docker.sock",
"type": "bind",
"options": [
"bind"
]
}
]
}

15
go.mod Normal file
View File

@@ -0,0 +1,15 @@
module git.ivasoft.cz/sw/objectivefs-docker-volume
go 1.20
require github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651
require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/docker/go-connections v0.4.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.6.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/tools v0.6.0 // indirect
)

17
go.sum Normal file
View File

@@ -0,0 +1,17 @@
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU=
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651 h1:YcvzLmdrP/b8kLAGJ8GT7bdncgCAiWxJZIlt84D+RJg=
github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651/go.mod h1:LFyLie6XcDbyKGeVK6bHe+9aJTYCxWLBg5IrJZOaXKA=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=