go-tsviewer/Dockerfile

40 lines
808 B
Docker
Raw Normal View History

2019-01-31 16:26:30 +00:00
2019-01-31 17:05:42 +00:00
<<<<<<< HEAD
2019-01-31 17:04:45 +00:00
FROM golang:latest
RUN mkdir /app
RUN mkdir -p /app
WORKDIR /app
RUN go get -u
RUN go build -o main .
CMD ["/app/main"]
ADD . /app
RUN go build ./main.go
2019-01-31 17:05:42 +00:00
CMD ["./main"]
=======
2019-01-31 16:26:30 +00:00
# Install git.
# Git is required for fetching the dependencies.
RUN apk update && apk add --no-cache git
WORKDIR $GOPATH/src/git.cliffbreak.de/Cliffbreak/tsviewer
COPY . .
# Fetch dependencies.
# Using go get.
RUN go get -d -v
# Build the binary.
2019-01-31 16:28:38 +00:00
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /go/bin/main
2019-01-31 16:26:30 +00:00
############################
# STEP 2 build a small image
############################
FROM scratch
# Copy our static executable.
COPY --from=builder /go/bin/main /go/bin/main
# Run the hello binary.
2019-01-31 17:05:42 +00:00
ENTRYPOINT ["/go/bin/main"]
>>>>>>> 5012872895a69040a761a5dec89f72e6c87adbd0