Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bee dockerize produced Dockerfile fails (due to use of godep) #712

Open
crush-157 opened this issue Aug 7, 2020 · 2 comments
Open

bee dockerize produced Dockerfile fails (due to use of godep) #712

crush-157 opened this issue Aug 7, 2020 · 2 comments

Comments

@crush-157
Copy link

I have created a new beego app:

$ bee new quickstart
$ cd quickstart
$ bee run

So it's vanilla but working.

I then run:

$ bee dockerize
$ docker build -t beego-test .

The docker build fails with the following output:

Sending build context to Docker daemon  14.56MB
Step 1/10 : FROM library/golang
 ---> baaca3151cdb
Step 2/10 : RUN go get github.com/tools/godep
 ---> Using cache
 ---> 1142429ea03e
Step 3/10 : RUN CGO_ENABLED=0 go install -a std
 ---> Using cache
 ---> eba8f171d884
Step 4/10 : ENV APP_DIR $GOPATH/src/quickstart
 ---> Using cache
 ---> bd71a713d1ff
Step 5/10 : RUN mkdir -p $APP_DIR
 ---> Using cache
 ---> d945a5880667
Step 6/10 : ENTRYPOINT (cd $APP_DIR && ./quickstart)
 ---> Using cache
 ---> c68868e6049b
Step 7/10 : ADD . $APP_DIR
 ---> Using cache
 ---> e47cc4b72934
Step 8/10 : RUN cd $APP_DIR && CGO_ENABLED=0 godep go build -ldflags '-d -w -s'
 ---> Running in e96e84b45040
godep: No Godeps found (or in any parent directory)
The command '/bin/sh -c cd $APP_DIR && CGO_ENABLED=0 godep go build -ldflags '-d -w -s'' returned a non-zero code: 1

The main issue seems to be use of godep instead of dep.

I have edited the bee dockerize generated Dockerfile as follows:

FROM library/golang

RUN apt-get update
RUN apt-get install -y go-dep

# Recompile the standard library without CGO
RUN CGO_ENABLED=0 go install -a std

WORKDIR $GOPATH/src/quickstart
COPY . .

# Compile the binary and statically link
RUN dep ensure
RUN go mod vendor
RUN CGO_ENABLED=0 go build -ldflags '-d -w -s'

# Set the entrypoint
ENTRYPOINT ./quickstart

EXPOSE 8080

And lo, it worketh.

@askuy
Copy link
Collaborator

askuy commented Aug 21, 2020

change the dep to go mod?

@crush-157
Copy link
Author

Correct - (see Dockerfile above) - I also opened a PR #713

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants