added alpine build image

This commit is contained in:
Brad Rydzewski 2015-08-09 15:36:25 -07:00
parent be8f31f0fd
commit c6b9d09602
5 changed files with 57 additions and 2 deletions

View file

@ -3,6 +3,7 @@ cmd/drone-server/drone_bindata.go
dist/
doc/
.git/
.dockerignore
.drone.yml
.gitignore

26
Dockerfile.alpine Normal file
View file

@ -0,0 +1,26 @@
# Docker image for the Drone build runner
#
# docker build --file=Dockerfile.alpine --rm=true -t drone/drone-alpine .
FROM alpine:3.2
EXPOSE 8080
ENV GOROOT=/usr/lib/go \
GOPATH=/gopath \
GOBIN=/gopath/bin \
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
WORKDIR /gopath/src/github.com/drone/drone
ADD . /gopath/src/github.com/drone/drone
RUN apk add -U go ca-certificates libc-dev gcc git sqlite-libs && \
go get github.com/jteeuwen/go-bindata/... && \
/gopath/bin/go-bindata -o="cmd/drone-server/drone_bindata.go" cmd/drone-server/static/... && \
go run make.go build && \
apk del git go gcc libc-dev && \
mv bin/drone /bin/drone && \
rm -rf /gopath && \
rm -rf /var/cache/apk/*
ENTRYPOINT ["/bin/drone"]

View file

@ -0,0 +1,25 @@
# Docker image for the Drone build runner
#
# cd $GOPATH/src/github.com/drone/drone
# docker build --file=cmd/drone-build/Dockerfile.alpine --rm=true -t drone/drone-build .
FROM alpine:3.2
ENV GOROOT=/usr/lib/go \
GOPATH=/gopath \
GOBIN=/gopath/bin \
CGO_ENABLED=0 \
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
WORKDIR /gopath/src/github.com/drone/drone
ADD . /gopath/src/github.com/drone/drone
RUN apk add -U go ca-certificates && \
cd cmd/drone-build && \
go build -a -tags netgo && \
apk del go && \
mv drone-build /bin/drone-build && \
rm -rf /gopath && \
rm -rf /var/cache/apk/*
ENTRYPOINT ["/bin/drone-build"]

View file

@ -241,7 +241,7 @@ func main() {
http.Handle("/static/", static())
http.Handle("/", r)
err = http.ListenAndServe(settings.Server.Addr, nil)
err = http.ListenAndServe(conf.server.addr, nil)
if err != nil {
log.Error("Cannot start server: ", err)
}

View file

@ -154,6 +154,9 @@ func trace(args []string) {
// helper function to parse the git revision
func rev() string {
cmd := exec.Command("git", "rev-parse", "--short", "HEAD")
raw, _ := cmd.CombinedOutput()
raw, err := cmd.CombinedOutput()
if err != nil {
return "HEAD"
}
return strings.Trim(string(raw), "\n")
}