我正在使用新的GoLand IDE和Docker构建一个Go项目。不幸的是,我无法正确配置我的GOROOT
,这使得无法充分利用GoLand的功能。
我有以下dockerfile:
FROM golang:1.9.3
# allows app_env to be set during build (defaults to empty string)
ARG app_env
# sets an environment variable to app_env argument, this way the variable will persist in the container for use in code
ENV APP_ENV $app_env
COPY ./ /go/src/github.com/Name/ProjectName/
WORKDIR /go/src/github.com/Name/ProjectName/app
# install all dependencies
RUN go get ./...
# build the binary
RUN go build
# Put back once we have an application
RUN app
EXPOSE 8080
我现在按照以下步骤执行我的项目:
docker build -t project-name .
docker run -it -v ~/project-dir:/go/src/github.com/Name/ProjectName/app
usr/local/go/bin
作为我的GoRoot,这在GoLand中是否可能?(如果不可能,为什么要添加“docker支持”?)