2

I have an automated build system, and I took the drone.io 8.5 docs on building, and placed them in a script which outputs the golang built binary.

Then I use drone (ha) to build a dockefile that is ultimately used in production.

I am trying to updgrade drone by using drone to build new drone containers but they all flap with the same error:

standard_init_linux.go:185: exec user process caused "no such file or directory"

It would seem to me everything is in the right place.

My build script pulls the SHA I want and does the build steps:

#! /bin/bash

set -e
set -u

PKG=github.com/drone/drone
REPO=https://${PKG}.git
SHA=81103a98208b0bfc76be5b07194f359fbc80183b
PATH=$GOPATH/bin:$PATH

cd $GOPATH
git clone $REPO src/${PKG}
cd src/${PKG}
git checkout -qf $SHA

# setup drone
go get -u github.com/drone/drone-ui/dist
go get -u golang.org/x/net/context
go get -u golang.org/x/net/context/ctxhttp
go get -u github.com/golang/protobuf/proto
go get -u github.com/golang/protobuf/protoc-gen-go

go install github.com/drone/drone/cmd/drone-agent
go install github.com/drone/drone/cmd/drone-server

mkdir release
cp $GOPATH/bin/drone-server release/drone-server

echo "Complete"

The the drone docker plugin builds my container, based on the official Dockerfile of that release (8.5, which is below):

docker:
  image: plugins/docker
  repo: myprivatereg.com/org/docker-drone
  dockerfile: /drone/src/github.com/drone/drone/Dockerfile
  context: /drone/src/github.com/drone/drone
  tags:
    - ${DRONE_BRANCH}-latest
    - ${DRONE_COMMIT}

The Dockerfile in this case is:

# docker build --rm -t drone/drone .

FROM drone/ca-certs
EXPOSE 8000 9000 80 443

ENV DATABASE_DRIVER=sqlite3
ENV DATABASE_CONFIG=/var/lib/drone/drone.sqlite
ENV GODEBUG=netdns=go
ENV XDG_CACHE_HOME /var/lib/drone

ADD release/drone-server /bin/

ENTRYPOINT ["/bin/drone-server"]

I cannot for the life of me see the issue as to me it looks like the binary would be in the right place. The only other point of issue is the build environment but I have broken those steps manually with the same result.

eignhpants
  • 1,611
  • 4
  • 26
  • 49

1 Answers1

0

The problem with your build is that you're not building a binary that can be executed inside the docker container, hence the exec user process error.

The quick fix for your issue would be to add cross-compilation flags to your go install. This will also result in the binary being placed in a slightly different location so your build file will look like this:

GOOS=linux GOARCH=386 go install github.com/drone/drone/cmd/drone-agent
GOOS=linux GOARCH=386 go install github.com/drone/drone/cmd/drone-server

mkdir release
cp $GOPATH/bin/linux_386/drone-server release/drone-server

The proper (and more complicated) way to adress this would be to use a multi-stage Dockerfile with a build step first, see e.g. this blog post with an example.

Oliver
  • 11,857
  • 2
  • 36
  • 42