diff --git a/Makefile b/Makefile index e49ead72..7b1e7fa6 100644 --- a/Makefile +++ b/Makefile @@ -84,21 +84,13 @@ kubevpn-linux-386: .PHONY: container container: - docker build -t ${IMAGE} -f $(BUILD_DIR)/Dockerfile . - docker push ${IMAGE} - docker tag ${IMAGE} ${IMAGE_DEFAULT} - docker push ${IMAGE_DEFAULT} + docker buildx build --platform linux/amd64,linux/arm64 -t ${IMAGE} -t ${IMAGE_DEFAULT} -f $(BUILD_DIR)/Dockerfile --push . ############################ build local .PHONY: container-local container-local: kubevpn-linux-amd64 - docker build --platform linux/amd64 -t ${IMAGE} -f $(BUILD_DIR)/local.Dockerfile . - docker push ${IMAGE} - docker tag ${IMAGE} ${IMAGE_DEFAULT} - docker push ${IMAGE_DEFAULT} + docker buildx build --platform linux/amd64 -t ${IMAGE} -f $(BUILD_DIR)/local.Dockerfile . .PHONY: container-test container-test: kubevpn-linux-amd64 - docker build --platform linux/amd64 -t ${IMAGE} -f $(BUILD_DIR)/test.Dockerfile . - docker tag ${IMAGE} docker.io/naison/kubevpn:testp - docker push docker.io/naison/kubevpn:testp \ No newline at end of file + docker buildx build --platform linux/amd64 -t ${IMAGE} -f $(BUILD_DIR)/test.Dockerfile . \ No newline at end of file diff --git a/build/Dockerfile b/build/Dockerfile index 6a67085a..bbddf852 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,16 +1,17 @@ -ARG BASE=github.com/wencaiwulue/kubevpn - FROM envoyproxy/envoy:v1.25.0 AS envoy FROM golang:1.19 AS builder +ARG BASE=github.com/wencaiwulue/kubevpn COPY . /go/src/$BASE WORKDIR /go/src/$BASE RUN go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn,direct -RUN make kubevpn-linux-amd64 +RUN make kubevpn +RUN go install github.com/go-delve/delve/cmd/dlv@latest FROM ubuntu:latest +ARG BASE=github.com/wencaiwulue/kubevpn 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 @@ -20,4 +21,5 @@ RUN apt-get clean && apt-get update && apt-get install -y wget dnsutils vim curl WORKDIR /app COPY --from=builder /go/src/$BASE/bin/kubevpn /usr/local/bin/kubevpn -COPY --from=envoy /usr/local/bin/envoy /usr/local/bin/envoy \ No newline at end of file +COPY --from=builder /go/bin/dlv /usr/local/bin/dlv +COPY --from=envoy /usr/local/bin/envoy /usr/local/bin/envoy diff --git a/pkg/dev/main.go b/pkg/dev/main.go index 635e255f..bb98dcca 100644 --- a/pkg/dev/main.go +++ b/pkg/dev/main.go @@ -259,7 +259,7 @@ func (r Run) copyToContainer(ctx context.Context, volume []mount.Mount, cli *cli CopyUIDGID: true, }) if err != nil { - log.Info(fmt.Errorf("can not copy %s to %s of container %s:%s, err: %v", v.Source, id, v.Target, err)) + log.Info(fmt.Errorf("can not copy %s to container %s:%s, err: %v", v.Source, id, v.Target, err)) } } return nil diff --git a/pkg/dev/run.go b/pkg/dev/run.go index 5341dd90..a77d9a46 100644 --- a/pkg/dev/run.go +++ b/pkg/dev/run.go @@ -118,6 +118,6 @@ func terminal(c string, cli *command.DockerCli) error { options.Interactive = true options.TTY = true options.Container = c - options.Command = []string{"/bin/sh"} + options.Command = []string{"sh", "-c", `command -v bash >/dev/null && exec bash || exec sh`} return container.RunExec(cli, options) }