playground: isolate playground build stage in Docker
This ensures that our build environment is isolated from the faketime
build environment.
Updates golang/go#25224
Change-Id: I7ad483f34483bc00ef097e8b92ce45d8936f47f1
Reviewed-on: https://go-review.googlesource.com/c/playground/+/228262
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/Dockerfile b/Dockerfile
index b402acc..5a314c1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@
ARG GO_VERSION=go1.14.1
-FROM debian:buster AS build
+FROM debian:buster AS go-faketime
LABEL maintainer="golang-dev@googlegroups.com"
ENV BUILD_DEPS 'curl git gcc patch libc6-dev ca-certificates'
@@ -36,6 +36,8 @@
ENV GOROOT /usr/local/go-faketime
RUN ../bin/go install --tags=faketime std
+FROM golang:1.14 as build-playground
+
COPY go.mod /go/src/playground/go.mod
COPY go.sum /go/src/playground/go.sum
WORKDIR /go/src/playground
@@ -51,7 +53,7 @@
RUN apt-get update && apt-get install -y git ca-certificates --no-install-recommends
-COPY --from=build /usr/local/go-faketime /usr/local/go-faketime
+COPY --from=go-faketime /usr/local/go-faketime /usr/local/go-faketime
ARG GO_VERSION
ENV GO_VERSION ${GO_VERSION}
@@ -80,7 +82,7 @@
RUN mkdir /app
-COPY --from=build /go/bin/playground /app
+COPY --from=build-playground /go/bin/playground /app
COPY edit.html /app
COPY static /app/static
COPY examples /app/examples