Skip to content

Commit

Permalink
make.go: add -offline flag (#1290)
Browse files Browse the repository at this point in the history
Also update to Go1.13.5

Fixes #1286
  • Loading branch information
mpl committed Dec 20, 2019
1 parent d9e34b7 commit 67333e3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Expand Up @@ -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
Expand Down
24 changes: 23 additions & 1 deletion make.go
Expand Up @@ -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 (
Expand Down Expand Up @@ -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" {
Expand Down
7 changes: 4 additions & 3 deletions misc/docker/go/Dockerfile
Expand Up @@ -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.