-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use docker multi-stage build to eliminate dependencies on exter…
…nal environments
- Loading branch information
1 parent
393d1cf
commit ef04a09
Showing
1 changed file
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
FROM ubuntu:18.04 | ||
FROM golang:alpine as go-builder | ||
|
||
RUN go env -w CGO_ENABLED=0 | ||
|
||
WORKDIR /build | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN go build -trimpath -ldflags '-extldflags "-static -fpic" -s -w' -o ./flydb-server cmd/server/cli/flydb-server.go | ||
|
||
FROM alpine:latest | ||
|
||
WORKDIR /app | ||
|
||
COPY bin/flydb-server /app/flydb-server | ||
COPY --from=go-builder /build/flydb-server /app/flydb-server | ||
|
||
RUN chmod +x /app/flydb-server | ||
|
||
CMD ["/app/flydb-server"] | ||
EXPOSE 8999 | ||
|
||
ENTRYPOINT ["/app/flydb-server"] |