This commit is contained in:
Moritz 2019-01-31 18:05:42 +01:00
commit 66fc41cc7f

View file

@ -1,4 +1,5 @@
<<<<<<< HEAD
FROM golang:latest FROM golang:latest
RUN mkdir /app RUN mkdir /app
RUN mkdir -p /app RUN mkdir -p /app
@ -8,4 +9,31 @@ RUN go build -o main .
CMD ["/app/main"] CMD ["/app/main"]
ADD . /app ADD . /app
RUN go build ./main.go RUN go build ./main.go
CMD ["./main"] CMD ["./main"]
=======
# 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.
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /go/bin/main
############################
# 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.
ENTRYPOINT ["/go/bin/main"]
>>>>>>> 5012872895a69040a761a5dec89f72e6c87adbd0