fixing up dockerfile for build and added missing vendor

This commit is contained in:
josebarn
2017-08-15 23:29:51 -03:00
parent 3fe7bdb762
commit e2ca326b66
8 changed files with 551 additions and 6 deletions

View File

@@ -2,12 +2,17 @@
FROM golang:latest
# Copy in code...
RUN mkdir /app
ADD main.go /app/
RUN mkdir -p /go/src/github.com/josebarn/drone-with-go
ADD main.go /go/src/github.com/josebarn/drone-with-go/
ADD api/ /go/src/github.com/josebarn/drone-with-go/api/
ADD model/ /go/src/github.com/josebarn/drone-with-go/model/
ADD vendor/ /go/src/github.com/josebarn/drone-with-go/vendor/
RUN ls -laR
# Build app
WORKDIR /app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o hello .
WORKDIR /go/src/github.com/josebarn/drone-with-go
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o hello-world .
# Could use something even smaller...
FROM alpine:latest
@@ -15,9 +20,9 @@ RUN apk --no-cache add ca-certificates
RUN mkdir /app
WORKDIR /app/
COPY --from=0 /app/hello .
COPY --from=0 /go/src/github.com/josebarn/drone-with-go/hello-world .
# Expose ports for future REST Interface
EXPOSE 8080
CMD ["/app/hello"]
CMD ["/app/hello-world"]