From 75684a307b38602651e4869b0df686555268af3d Mon Sep 17 00:00:00 2001 From: wencaiwulue <895703375@qq.com> Date: Sat, 29 Oct 2022 12:49:58 +0800 Subject: [PATCH] fix: add dockerfile for building locally --- Makefile | 21 +++++++++++++++++++++ build/control_plane/local.Dockerfile | 10 ++++++++++ build/server/local.Dockerfile | 10 ++++++++++ pkg/test/local.go | 2 +- pkg/test/server/server.go | 2 +- 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 build/control_plane/local.Dockerfile create mode 100644 build/server/local.Dockerfile diff --git a/Makefile b/Makefile index a78e97df..f710cd67 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,9 @@ kubevpn-linux-amd64 kubevpn-linux-386 kubevpn-linux-arm64 .PHONY: all-image all-image: image image-mesh image-control-plane +.PHONY: all-image-local +all-image-local: image-local image-mesh-local image-control-plane-local + .PHONY: kubevpn kubevpn: make $(TARGET) @@ -98,3 +101,21 @@ image-control-plane: docker push $(REGISTRY)/envoy-xds-server:${VERSION} docker push $(REGISTRY)/envoy-xds-server:latest +############################ build local +.PHONY: image-local +image-local: kubevpn-linux-amd64 + docker build -t $(REGISTRY)/kubevpn:${VERSION} -f $(BUILD_DIR)/server/local.Dockerfile . + docker tag $(REGISTRY)/kubevpn:${VERSION} $(REGISTRY)/kubevpn:latest + docker push $(REGISTRY)/kubevpn:${VERSION} + +.PHONY: image-mesh-local +image-mesh-local: + docker build -t $(REGISTRY)/kubevpn-mesh:${VERSION} -f $(BUILD_DIR)/mesh/local.Dockerfile . + docker tag $(REGISTRY)/kubevpn-mesh:${VERSION} $(REGISTRY)/kubevpn-mesh:latest + docker push $(REGISTRY)/kubevpn-mesh:${VERSION} + +.PHONY: image-control-plane-local +image-control-plane-local: + docker build -t $(REGISTRY)/envoy-xds-server:${VERSION} -f $(BUILD_DIR)/control_plane/local.Dockerfile . + docker tag $(REGISTRY)/envoy-xds-server:${VERSION} $(REGISTRY)/envoy-xds-server:latest + docker push $(REGISTRY)/envoy-xds-server:${VERSION} diff --git a/build/control_plane/local.Dockerfile b/build/control_plane/local.Dockerfile new file mode 100644 index 00000000..e6ce4449 --- /dev/null +++ b/build/control_plane/local.Dockerfile @@ -0,0 +1,10 @@ +FROM ubuntu:latest + +RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list \ + && sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list +RUN apt-get clean && apt-get update && apt-get install -y wget dnsutils vim curl \ + net-tools iptables iputils-ping lsof iproute2 tcpdump + +WORKDIR /app + +COPY bin/envoy-xds-server /bin/envoy-xds-server \ No newline at end of file diff --git a/build/server/local.Dockerfile b/build/server/local.Dockerfile new file mode 100644 index 00000000..89b9dba9 --- /dev/null +++ b/build/server/local.Dockerfile @@ -0,0 +1,10 @@ +FROM ubuntu:latest + +RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list \ + && sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list +RUN apt-get clean && apt-get update && apt-get install -y wget dnsutils vim curl \ + net-tools iptables iputils-ping lsof iproute2 tcpdump + +WORKDIR /app + +COPY bin/kubevpn-linux-amd64 /usr/local/bin/kubevpn \ No newline at end of file diff --git a/pkg/test/local.go b/pkg/test/local.go index 64081d08..a1cc6d0e 100644 --- a/pkg/test/local.go +++ b/pkg/test/local.go @@ -6,7 +6,7 @@ import ( log "github.com/sirupsen/logrus" - "github.com/wencaiwulue/kubevpn/tun" + "github.com/wencaiwulue/kubevpn/pkg/tun" ) func main() { diff --git a/pkg/test/server/server.go b/pkg/test/server/server.go index a56780d7..f5cfda81 100644 --- a/pkg/test/server/server.go +++ b/pkg/test/server/server.go @@ -6,7 +6,7 @@ import ( log "github.com/sirupsen/logrus" - "github.com/wencaiwulue/kubevpn/tun" + "github.com/wencaiwulue/kubevpn/pkg/tun" ) func main() {