Reuse go docker build cache (#1218)

This commit is contained in:
Ta-Ching Chen
2019-07-06 09:30:27 +08:00
committed by GitHub
parent 9f51f9064d
commit 78a774cfd9
7 changed files with 90 additions and 25 deletions
+7 -4
View File
@@ -1,21 +1,24 @@
ARG GO_VERSION=1.9.2
FROM ubuntu:18.04 AS base
WORKDIR /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
FROM golang:${GO_VERSION} AS builder
ENV GOPATH /usr
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
WORKDIR ${APP}
ADD context ${APP}/context
ADD server.go ${APP}
WORKDIR ${APP}
RUN go get
RUN go build -a -o /server server.go
FROM ubuntu:18.04
WORKDIR /
FROM base
COPY --from=builder /server /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/server"]
EXPOSE 8888
+7 -4
View File
@@ -1,21 +1,24 @@
ARG GO_VERSION=1.11.4
FROM ubuntu:18.04 AS base
WORKDIR /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
FROM golang:${GO_VERSION} AS builder
ENV GOPATH /usr
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
WORKDIR ${APP}
ADD context ${APP}/context
ADD server.go ${APP}
WORKDIR ${APP}
RUN go get
RUN go build -a -o /server server.go
FROM ubuntu:18.04
WORKDIR /
FROM base
COPY --from=builder /server /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/server"]
EXPOSE 8888