You can not 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
727 B
29 lines
727 B
## 1. Build Server
|
|
# Use Go 1.11
|
|
FROM golang:1.11 AS build
|
|
|
|
# Load repository into docker
|
|
WORKDIR /go/src/git.aiterp.net/rpdata/logbot3/
|
|
COPY . .
|
|
RUN rm -rf ./vendor
|
|
|
|
# Load and run dependencies
|
|
RUN go get -u github.com/golang/dep/cmd/dep
|
|
RUN dep ensure
|
|
|
|
# Build server and tools (CGO disabled to make them 100% static)
|
|
ENV CGO_ENABLED 0
|
|
RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/logbot3 .
|
|
|
|
## 2. Distribute
|
|
# Use alpine linux
|
|
FROM alpine:3.8 as main-dist
|
|
|
|
# Install certificates to enable HTTPS GET requests
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
# Copy build files into final container
|
|
COPY --from=build /binaries/* /usr/local/bin/
|
|
|
|
# The server is the main entry point
|
|
CMD ["/usr/local/bin/logbot3"]
|