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

Also update to Go1.13.5

Fixes #1286
This commit is contained in:
mpl 2019-12-20 11:47:20 +01:00 committed by GitHub
parent d9e34b748c
commit 67333e3a9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 6 deletions

View File

@ -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
View File

@ -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" {

View File

@ -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