Skip to content
Permalink
Browse files

make.go: add -offline flag (#1290)

Also update to Go1.13.5

Fixes #1286
  • Loading branch information
mpl committed Dec 20, 2019
1 parent d9e34b7 commit 67333e3a9c010af19a9ef7cbc32fd46dd1c4f013
Showing with 29 additions and 6 deletions.
  1. +2 −2 Dockerfile
  2. +23 −1 make.go
  3. +4 −3 misc/docker/go/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
24 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" {
@@ -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

0 comments on commit 67333e3

Please sign in to comment.
You can’t perform that action at this time.