build: optimize docker build times
This commit is contained in:
parent
1e0ee5bffe
commit
3a38ff13ca
1 changed files with 6 additions and 4 deletions
10
Dockerfile
10
Dockerfile
|
|
@ -1,17 +1,20 @@
|
||||||
FROM golang:alpine AS builder
|
FROM golang:alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apk --no-cache add make;
|
RUN apk --no-cache add make;
|
||||||
|
|
||||||
|
COPY go.mod .
|
||||||
|
COPY go.sum .
|
||||||
|
|
||||||
|
RUN go mod download;
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make hivemind;
|
ENV GOCACHE=/cache/go-build
|
||||||
|
RUN --mount=type=cache,target="/cache/go-build" mkdir -p /cache/go-build; make hivemind;
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
EXPOSE 56714/tcp
|
EXPOSE 56714/tcp
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
VOLUME /conf
|
VOLUME /conf
|
||||||
|
|
@ -21,5 +24,4 @@ ENV HIVEMIND_CONFIG_FILE=/conf/config.toml
|
||||||
ENV HIVEMIND_REGISTRY_FILE=/data/registry.json
|
ENV HIVEMIND_REGISTRY_FILE=/data/registry.json
|
||||||
|
|
||||||
COPY --from=builder /app/build/hivemind .
|
COPY --from=builder /app/build/hivemind .
|
||||||
|
|
||||||
CMD ["./hivemind"]
|
CMD ["./hivemind"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue