added frps and frpc dockerfile
This commit is contained in:
parent
9124605924
commit
c0ec34c3f9
7
.netrc
Normal file
7
.netrc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
machine github.com
|
||||||
|
login spectro-prow
|
||||||
|
password 51c3e8a896ac8d85ba13b0e48f9cd13d26e4a438
|
||||||
|
|
||||||
|
machine api.github.com
|
||||||
|
login spectro-prow
|
||||||
|
password 51c3e8a896ac8d85ba13b0e48f9cd13d26e4a438
|
10
Makefile
10
Makefile
@ -1,6 +1,8 @@
|
|||||||
export PATH := $(GOPATH)/bin:$(PATH)
|
export PATH := $(GOPATH)/bin:$(PATH)
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
LDFLAGS := -s -w
|
LDFLAGS := -s -w
|
||||||
|
FRPC_IMG ?= "gcr.io/spectro-common-dev/${USER}/frpc:latest"
|
||||||
|
FRPS_IMG ?= "gcr.io/spectro-common-dev/${USER}/frps:latest"
|
||||||
|
|
||||||
all: fmt build
|
all: fmt build
|
||||||
|
|
||||||
@ -22,9 +24,17 @@ vet:
|
|||||||
frps:
|
frps:
|
||||||
env CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o bin/frps ./cmd/frps
|
env CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o bin/frps ./cmd/frps
|
||||||
|
|
||||||
|
docker-frps:
|
||||||
|
docker build . -t ${FRPS_IMG} -f build/frps/Dockerfile
|
||||||
|
docker push ${FRPS_IMG}
|
||||||
|
|
||||||
frpc:
|
frpc:
|
||||||
env CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o bin/frpc ./cmd/frpc
|
env CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o bin/frpc ./cmd/frpc
|
||||||
|
|
||||||
|
docker-frpc:
|
||||||
|
docker build . -t ${FRPC_IMG} -f build/frpc/Dockerfile
|
||||||
|
docker push ${FRPC_IMG}
|
||||||
|
|
||||||
test: gotest
|
test: gotest
|
||||||
|
|
||||||
gotest:
|
gotest:
|
||||||
|
27
build/frpc/Dockerfile
Normal file
27
build/frpc/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Build the manager binary
|
||||||
|
FROM golang:1.16 as builder
|
||||||
|
|
||||||
|
ADD .netrc /root/.netrc
|
||||||
|
|
||||||
|
RUN chmod 600 /root/.netrc
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
# Copy the Go Modules manifests
|
||||||
|
COPY go.mod go.mod
|
||||||
|
COPY go.sum go.sum
|
||||||
|
# cache deps before building and copying source so that we don't need to re-download as much
|
||||||
|
# and so that source changes don't invalidate our downloaded layer
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy the go source
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o frpc cmd/frpc/main.go
|
||||||
|
|
||||||
|
# Use distroless as minimal base image to package the manager binary
|
||||||
|
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
||||||
|
FROM gcr.io/distroless/static:latest
|
||||||
|
WORKDIR /
|
||||||
|
COPY --from=builder /workspace/frpc .
|
||||||
|
ENTRYPOINT ["/frpc"]
|
27
build/frps/Dockerfile
Normal file
27
build/frps/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Build the manager binary
|
||||||
|
FROM golang:1.16 as builder
|
||||||
|
|
||||||
|
ADD .netrc /root/.netrc
|
||||||
|
|
||||||
|
RUN chmod 600 /root/.netrc
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
# Copy the Go Modules manifests
|
||||||
|
COPY go.mod go.mod
|
||||||
|
COPY go.sum go.sum
|
||||||
|
# cache deps before building and copying source so that we don't need to re-download as much
|
||||||
|
# and so that source changes don't invalidate our downloaded layer
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy the go source
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o frps cmd/frps/main.go
|
||||||
|
|
||||||
|
# Use distroless as minimal base image to package the manager binary
|
||||||
|
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
||||||
|
FROM gcr.io/distroless/static:latest
|
||||||
|
WORKDIR /
|
||||||
|
COPY --from=builder /workspace/frps .
|
||||||
|
ENTRYPOINT ["/frps"]
|
Loading…
Reference in New Issue
Block a user