You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
781 B
Docker
29 lines
781 B
Docker
# Multi-stage build form
|
|
FROM golang:latest
|
|
|
|
# Copy in code...
|
|
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 /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
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
RUN mkdir /app
|
|
WORKDIR /app/
|
|
COPY --from=0 /go/src/github.com/josebarn/drone-with-go/hello-world .
|
|
|
|
# Expose ports for future REST Interface
|
|
EXPOSE 8080
|
|
|
|
CMD ["/app/hello-world"]
|