dockerfile:
FROM golang:1.16-alpine
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /app
COPY go.mod go.sum ./
RUN go env -w GO111MODULE=on&&go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
RUN go mod download
COPY . .
RUN go build -o main .
CMD ["./main"]
go mod:
module graph-server
go 1.16
require (
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/gin-gonic/gin v1.7.4
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/validator/v10 v10.9.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/graphql-go/graphql v0.8.0
github.com/graphql-go/handler v0.2.3
github.com/howeyc/fsnotify v0.9.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pilu/config v0.0.0-20131214182432-3eb99e6c0b9a // indirect
github.com/pilu/fresh v0.0.0-20190826141211-0fa698148017 // indirect
github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 // indirect
github.com/swaggo/gin-swagger v1.3.1 // indirect
github.com/swaggo/swag v1.7.1 // indirect
github.com/ugorji/go v1.2.6 // indirect
github.com/vesoft-inc/nebula-go/v2 v2.5.0
github.com/vesoft-inc/nebula-http-gateway v0.0.0-20210726061919-6d3b6b6a2175
golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 // indirect
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8 // indirect
golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.5 // indirect
google.golang.org/protobuf v1.27.1 // indirect
github.com/deckarep/golang-set v1.7.1
)
docker-compose.yml
version: '3.3'
networks:
backend:
driver: bridge
services:
web:
build:
context: .
dockerfile: Dockerfile
ports:
- "9108:8080"
restart: unless-stopped
expose:
- 8080
networks:
- backend
报错:
[root@sfz-janusgraph-hbase-1 graph-server]# docker-compose up
Building web
Step 1/9 : FROM golang:1.16-alpine
---> df1795ddbf41
Step 2/9 : RUN apk update && apk upgrade && apk add --no-cache bash git openssh
---> Using cache
---> a7edec541ebb
Step 3/9 : WORKDIR /app
---> Using cache
---> 010f71f745ee
Step 4/9 : COPY go.mod go.sum ./
---> 9f0e37259558
Step 5/9 : RUN go env -w GO111MODULE=on&&go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
---> Running in ca55fd742193
Removing intermediate container ca55fd742193
---> 4f589610614c
Step 6/9 : RUN go mod download
---> Running in 79460722ef7b
verifying github.com/vesoft-inc/nebula-go/v2@v2.5.0: checksum mismatch
downloaded: h1:7w3bUYTAtvEA20go5XFoEDx5HbnzlOgo5VBSP3AvXtE=
go.sum: h1:A4wZoGqR1W1mQ9y/X+tV1wCMIsDkuhFMthTQKMeT8Yc=
SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.
For more information, see 'go help module-auth'.
ERROR: Service 'web' failed to build: The command '/bin/sh -c go mod download' returned a non-zero code: 1