diff --git a/.travis.yml b/.travis.yml index fc4b8df52..746de0c77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,15 @@ before_script: - docker-compose -f docker-compose.travis.yml up -d --build script: - - docker-compose -f docker-compose.travis.yml exec photoprism make migrate test-codecov + - if [ "$TRAVIS_BRANCH" == "develop" ]; then docker-compose -f docker-compose.travis.yml exec photoprism make migrate test-codecov; fi + - if [ "$TRAVIS_BRANCH" != "develop" ]; then docker-compose -f docker-compose.travis.yml exec photoprism make migrate test; fi after_script: - docker-compose -f docker-compose.travis.yml down deploy: provider: script - script: make docker-push + script: make deploy-photoprism skip_cleanup: true on: branch: master \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5137a15d2..800bce6c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,81 +1,4 @@ -FROM ubuntu:18.04 - -LABEL maintainer="Michael Mayer " - -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - curl \ - libfreetype6-dev \ - libhdf5-serial-dev \ - libpng-dev \ - libzmq3-dev \ - pkg-config \ - rsync \ - software-properties-common \ - unzip \ - g++ \ - gcc \ - libc6-dev \ - gpg-agent \ - apt-utils \ - make \ - nano \ - wget \ - darktable \ - git \ - mysql-client \ - && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -RUN add-apt-repository ppa:pmjdebruijn/darktable-release - -RUN apt-get update && apt-get install -y --no-install-recommends \ - darktable \ - && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -RUN apt-get upgrade -y - -# Install TensorFlow C library -RUN curl -L \ - "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.11.0.tar.gz" | \ - tar -C "/usr/local" -xz -RUN ldconfig - -# Hide some warnings -ENV TF_CPP_MIN_LOG_LEVEL 2 - -# Install NPM (NodeJS) -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - -RUN apt-get install -y nodejs - -# Install YARN (Package Manager) -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - -RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list -RUN apt-get update && apt-get install yarn - -ENV GOLANG_VERSION 1.11.2 -RUN set -eux; \ - \ - url="https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz"; \ - wget -O go.tgz "$url"; \ - echo "1dfe664fa3d8ad714bbd15a36627992effd150ddabd7523931f077b3926d736d *go.tgz" | sha256sum -c -; \ - tar -C /usr/local -xzf go.tgz; \ - rm go.tgz; \ - export PATH="/usr/local/go/bin:$PATH"; \ - go version - -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" - -RUN env GO111MODULE=off /usr/local/go/bin/go get golang.org/x/tools/cmd/goimports +FROM photoprism/development:20181107 # Set up project directory WORKDIR "/go/src/github.com/photoprism/photoprism" @@ -84,8 +7,5 @@ COPY . . # Build PhotoPrism RUN make all install -# Expose HTTP port -EXPOSE 80 - # Start PhotoPrism server CMD photoprism start \ No newline at end of file diff --git a/Makefile b/Makefile index 9d7508d7f..38bafbc74 100644 --- a/Makefile +++ b/Makefile @@ -11,24 +11,25 @@ GOGET=$(GOCMD) get GOFMT=$(GOCMD) fmt GOIMPORTS=goimports BINARY_NAME=photoprism +DOCKER_TAG=`date -u +%Y%m%d` all: tensorflow-model dep js build install: install-bin install-assets install-config install-bin: - $(GOINSTALL) cmd/photoprism/photoprism.go + cp $(BINARY_NAME) /usr/local/bin/$(BINARY_NAME) install-assets: - mkdir -p /var/photoprism - mkdir -p /var/photoprism/photos - mkdir -p /var/photoprism/thumbnails - cp -r assets/favicons /var/photoprism - cp -r assets/public /var/photoprism - cp -r assets/templates /var/photoprism - cp -r assets/tensorflow /var/photoprism + mkdir -p /srv/photoprism + mkdir -p /srv/photoprism/photos + mkdir -p /srv/photoprism/thumbnails + cp -r assets/favicons /srv/photoprism + cp -r assets/public /srv/photoprism + cp -r assets/templates /srv/photoprism + cp -r assets/tensorflow /srv/photoprism install-config: mkdir -p /etc/photoprism test -e /etc/photoprism/photoprism.yml || cp -n configs/photoprism.yml /etc/photoprism/photoprism.yml build: - $(GOBUILD) cmd/photoprism/photoprism.go + scripts/build.sh js: (cd frontend && yarn install --prod) (cd frontend && env NODE_ENV=production npm run build) @@ -51,8 +52,15 @@ clean: rm -f $(BINARY_NAME) tensorflow-model: scripts/download-tf-model.sh -docker-push: - scripts/docker-push.sh +deploy-photoprism: + scripts/docker-build.sh photoprism $(DOCKER_TAG) + scripts/docker-push.sh photoprism $(DOCKER_TAG) +deploy-development: + scripts/docker-build.sh development $(DOCKER_TAG) + scripts/docker-push.sh development $(DOCKER_TAG) +deploy-tensorflow: + scripts/docker-build.sh tensorflow $(DOCKER_TAG) + scripts/docker-push.sh tensorflow $(DOCKER_TAG) fmt: $(GOIMPORTS) -w internal cmd $(GOFMT) ./internal/... ./cmd/... diff --git a/assets/templates/index.tmpl b/assets/templates/index.tmpl index c1123bdb2..6a0fc97a8 100644 --- a/assets/templates/index.tmpl +++ b/assets/templates/index.tmpl @@ -15,8 +15,8 @@