diff --git a/.travis.yml b/.travis.yml index 746de0c77..c368e8577 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ sudo: required +cache: + directories: + - $HOME/.cache + services: - docker diff --git a/Dockerfile b/Dockerfile index 254faa393..9dacffcfe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM photoprism/development:20181108 +FROM photoprism/development:20181109 # Set up project directory WORKDIR "/go/src/github.com/photoprism/photoprism" diff --git a/Makefile b/Makefile index a398cd37b..ec89cc0d6 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ install-config: build: scripts/build.sh js: - (cd frontend && yarn install --prod) + (cd frontend && yarn install --frozen-lockfile --prod) (cd frontend && env NODE_ENV=production npm run build) start: $(GORUN) cmd/photoprism/photoprism.go start diff --git a/docker-compose.travis.yml b/docker-compose.travis.yml index 8927c0107..43bacb9ea 100644 --- a/docker-compose.travis.yml +++ b/docker-compose.travis.yml @@ -5,6 +5,9 @@ services: build: . image: photoprism/photoprism:develop command: tail -f /dev/null + volumes: + - ~/.cache/yarn:/root/.cache/yarn + - ~/.cache/go-mod:/go/pkg/mod environment: - CODECOV_TOKEN - CODECOV_ENV diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index 965b2c3e0..177e98f4b 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -2,6 +2,7 @@ FROM ubuntu:18.04 LABEL maintainer="Michael Mayer " +# Install dev / build dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ curl \ @@ -51,6 +52,7 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +# Install Go ENV GOLANG_VERSION 1.11.2 RUN set -eux; \ \ @@ -62,12 +64,11 @@ RUN set -eux; \ export PATH="/usr/local/go/bin:$PATH"; \ go version +# Configure Go environment ENV GOPATH /go ENV GOBIN $GOPATH/bin ENV PATH $GOBIN:/usr/local/go/bin:$PATH ENV GO111MODULE on -ENV NODE_ENV production - RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" # Download TensorFlow model and test files @@ -78,16 +79,15 @@ RUN wget "https://www.dropbox.com/s/na9p9wwt98l7m5b/import.zip?dl=1" -O /tmp/pho # Install goimports RUN env GO111MODULE=off /usr/local/go/bin/go get golang.org/x/tools/cmd/goimports +# Configure JS environment for building +ENV NODE_ENV production +ENV YARN_CACHE_FOLDER /root/.cache/yarn + # Set up project directory WORKDIR "/go/src/github.com/photoprism/photoprism" -# Get PhotoPrism dependencies -COPY . . -RUN make dep -RUN rm -rf /go/src/github.com/photoprism/photoprism - # Expose HTTP port EXPOSE 80 -# Start PhotoPrism server +# Keep container running (services can be started manually using a terminal) CMD tail -f /dev/null \ No newline at end of file