diff --git a/Dockerfile b/Dockerfile index 8b5a9ec8f..1a73e6080 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,11 +22,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ pkg-config \ libsqlite3-dev -ENV GOLANG_VERSION 1.13.1 +ENV GOLANG_VERSION 1.13.5 WORKDIR /usr/local RUN wget -O go.tgz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz -RUN echo "94f874037b82ea5353f4061e543681a0e79657f787437974214629af8407d124 go.tgz" | sha256sum -c - +RUN echo "512103d7ad296467814a6e3f635631bd35574cab3369a97a323c9a585ccaa569 go.tgz" | sha256sum -c - RUN tar -zxvf go.tgz ENV GOROOT /usr/local/go diff --git a/make.go b/make.go index 008fa9fd9..3e304ce54 100644 --- a/make.go +++ b/make.go @@ -65,6 +65,7 @@ var ( camnetdns = flag.Bool("camnetdns", false, "Just build perkeep.org/server/camnetdns.") static = flag.Bool("static", false, "Build a static binary, so it can run in an empty container.") buildWebUI = flag.Bool("buildWebUI", false, "Rebuild the JS code of the web UI instead of fetching it from perkeep.org.") + offline = flag.Bool("offline", false, "Do not fetch the JS code for the web UI from perkeep.org. If not rebuilding the web UI, just trust the files on disk (if they exist).") ) var ( @@ -594,7 +595,28 @@ func doUI(withPerkeepd, withPublisher bool) error { } if !*buildWebUI { - return fetchAllJS(withPerkeepd, withPublisher) + if !*offline { + return fetchAllJS(withPerkeepd, withPublisher) + } + if withPublisher { + _, err := os.Stat(filepath.FromSlash(publisherJS)) + if os.IsNotExist(err) { + return fmt.Errorf("%s on disk is required for offline building. Fetch if first at %s.", publisherJS, publisherJSURL) + } + if err != nil { + return err + } + } + if withPerkeepd { + _, err := os.Stat(filepath.FromSlash(gopherjsUI)) + if os.IsNotExist(err) { + return fmt.Errorf("%s on disk is required for offline building. Fetch if first at %s.", gopherjsUI, gopherjsUIURL) + } + if err != nil { + return err + } + } + return nil } if os.Getenv("GO111MODULE") != "off" { diff --git a/misc/docker/go/Dockerfile b/misc/docker/go/Dockerfile index a1b54380a..0d774968c 100644 --- a/misc/docker/go/Dockerfile +++ b/misc/docker/go/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -y --no-install-recommends install ca-certificates libc6-dev RUN apt-get -y --no-install-recommends install git # Get Go stable release +ENV GOLANG_VERSION 1.13.5 WORKDIR /tmp -RUN curl -O https://storage.googleapis.com/golang/go1.13.1.linux-amd64.tar.gz -RUN echo '94f874037b82ea5353f4061e543681a0e79657f787437974214629af8407d124 go1.13.1.linux-amd64.tar.gz' | sha256sum -c -RUN tar -C /usr/local -xzf go1.13.1.linux-amd64.tar.gz +RUN curl -O https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz +RUN echo '512103d7ad296467814a6e3f635631bd35574cab3369a97a323c9a585ccaa569 go'${GOLANG_VERSION}'.linux-amd64.tar.gz' | sha256sum -c +RUN tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz