docker..
This commit is contained in:
parent
1441b942a9
commit
2250abb484
1 changed files with 10 additions and 29 deletions
39
Dockerfile
39
Dockerfile
|
@ -1,30 +1,11 @@
|
||||||
############################
|
|
||||||
# STEP 1 build executable binary
|
|
||||||
############################
|
|
||||||
FROM golang:alpine AS builder
|
|
||||||
|
|
||||||
# Install git.
|
FROM golang:latest
|
||||||
# Git is required for fetching the dependencies.
|
RUN mkdir /app
|
||||||
RUN apk update && apk add --no-cache git
|
RUN mkdir -p /app
|
||||||
|
WORKDIR /app
|
||||||
WORKDIR $GOPATH/src/git.cliffbreak.de/Cliffbreak/tsviewer
|
RUN go get -u
|
||||||
COPY . .
|
RUN go build -o main .
|
||||||
|
CMD ["/app/main"]
|
||||||
# Fetch dependencies.
|
ADD . /app
|
||||||
|
RUN go build ./main.go
|
||||||
# Using go get.
|
CMD ["./main"]
|
||||||
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"]
|
|
Loading…
Reference in a new issue