gpt4 book ai didi

docker - docker-compose up 后不会构建应用程序,因为不会安装 go-wrapper

转载 作者:行者123 更新时间:2023-12-01 22:23:00 30 4
gpt4 key购买 nike

您好,我是 Java 开发人员,但我有 golang 微服务,我想构建 docker 镜像。我有任何改变,但它不会再 build 了。

这是 Dockerfile

FROM golang:1.8-alpine

RUN apk add --no-cache git bash

WORKDIR /go/src/mailman
COPY . .

RUN go-wrapper download
RUN go-wrapper install

CMD ["go-wrapper", "run"]

这是 docker-compose up 后的结果
Building mailman
Step 1/7 : FROM golang:1.8-alpine
.
.
.
Step 6/7 : RUN go-wrapper install
---> Running in c3c55bd70517
+ exec go install -v
github.com/streadway/amqp
github.com/BurntSushi/toml
gopkg.in/yaml.v2
gopkg.in/mgo.v2/internal/json
gopkg.in/mgo.v2/internal/scram
werdewelt/mailman/domain
gopkg.in/gomail.v2
gopkg.in/mgo.v2/bson
gopkg.in/mgo.v2
github.com/jinzhu/configor
# github.com/jinzhu/configor
../../github.com/jinzhu/configor/utils.go:173: decoder.DisallowUnknownFields undefined (type *json.Decoder has no field or method DisallowUnknownFields)
ERROR: Service 'mailman' failed to build: The command '/bin/sh -c go-wrapper install' returned a non-zero code: 2


我已经尝试在此解决方案中升级到 golang:1.9.6-alpine3.7 如何,但这无济于事:
Docker for golang application

请帮忙!

最佳答案

我有一个解决方案。
谢谢 Burak Serdar

我已经升级到 1.14。这是我升级的 Dockerfile:


FROM golang:1.14-alpine3.11

RUN apk add --no-cache git bash

WORKDIR /go/src/mailman
COPY . .

RUN go get
RUN go install

CMD ["go", "run", "mailman.go"]

关于docker - docker-compose up 后不会构建应用程序,因为不会安装 go-wrapper,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61877357/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com