This commit is contained in:
Moritz 2019-01-31 18:04:45 +01:00
parent 1441b942a9
commit 2250abb484

View file

@ -1,30 +1,11 @@
############################
# STEP 1 build executable binary
############################
FROM golang:alpine AS builder
# 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 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -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"]
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
CMD ["./main"]