Add darktable development docker image #62

- Improved build scripts and Dockerfile
- broadwayd can be used as display server for darktable or other GTK based software
This commit is contained in:
Michael Mayer 2018-11-12 06:58:39 +01:00
parent 8ac8658cc2
commit c5ee0fee48
16 changed files with 243 additions and 46 deletions

View file

@ -4,9 +4,9 @@ internal/photoprism/testdata/*
frontend/node_modules/*
assets/server/public/build/*
Dockerfile
/docker
/photoprism
docker-compose*
/coverage.*
.dockerignore
.idea
.DS_Store

View file

@ -1,4 +1,4 @@
FROM photoprism/development:20181109
FROM photoprism/development:20181112
# Set up project directory
WORKDIR "/go/src/github.com/photoprism/photoprism"

View file

@ -16,7 +16,7 @@ DOCKER_TAG=`date -u +%Y%m%d`
all: download dep js build
install: install-bin install-assets install-config
install-bin:
scripts/build.sh install /usr/local/bin/$(BINARY_NAME)
scripts/build.sh prod /usr/local/bin/$(BINARY_NAME)
install-assets:
mkdir -p /srv/photoprism/photos
mkdir -p /srv/photoprism/cache
@ -60,6 +60,10 @@ deploy-development:
deploy-tensorflow:
scripts/docker-build.sh tensorflow $(DOCKER_TAG)
scripts/docker-push.sh tensorflow $(DOCKER_TAG)
deploy-darktable:
DARKTABLE_VERSION="$(awk '$2 == "DARKTABLE_VERSION" { print $3; exit }' docker/darktable/Dockerfile)"
scripts/docker-build.sh darktable $(DARKTABLE_VERSION)
scripts/docker-push.sh darktable $(DARKTABLE_VERSION)
fmt:
$(GOIMPORTS) -w internal cmd
$(GOFMT) ./internal/... ./cmd/...

View file

@ -4,9 +4,10 @@ services:
photoprism:
build: .
image: photoprism/photoprism:develop
command: tail -f /dev/null
command: broadwayd -p 8080 -a 0.0.0.0 :5
ports:
- 2342:80
- 2342:80 # Web Server (PhotoPrism)
- 2343:8080 # Broadwayd (HTML5 display server)
volumes:
- .:/go/src/github.com/photoprism/photoprism
environment:

View file

@ -0,0 +1,97 @@
FROM ubuntu:18.04
LABEL maintainer="Michael Mayer <michael@liquidbytes.net>"
WORKDIR "/src"
ENV DARKTABLE_VERSION 2.5.0
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LC_MESSAGES C.UTF-8
ENV LANGUAGE C.UTF-8
ENV GCC_VER=8
ENV LLVM_VER=7
ENV DEBIAN_FRONTEND noninteractive
# Paper over occasional network flakiness of some mirrors.
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry
# Do not install recommended packages
RUN echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends
# Do not install suggested packages
RUN echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests
# Assume yes
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes
# Fix broken packages
RUN echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissin
# Install general build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
gpg-agent \
apt-utils \
gpg \
gpgconf \
gpgv \
pkg-config \
nano \
wget
# Add llvm repo
RUN echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" | tee /etc/apt/sources.list.d/llvm.list
COPY /docker/darktable/llvm.gpg.key /tmp/llvm.gpg.key
RUN apt-key add /tmp/llvm.gpg.key
# Install darktable build depenencies
RUN apt-get update && apt-get install appstream-util clang-$LLVM_VER cmake desktop-file-utils \
g++-$GCC_VER gcc-$GCC_VER gettext git intltool libatk1.0-dev libcairo2-dev \
libcolord-dev libcolord-gtk-dev libcups2-dev libcurl4-gnutls-dev \
libexiv2-dev libflickcurl-dev libgdk-pixbuf2.0-dev libglib2.0-dev \
libgphoto2-dev libgraphicsmagick1-dev libgtk-3-dev libjpeg-dev \
libjson-glib-dev liblcms2-dev liblensfun-dev liblua5.2-dev liblua5.3-dev \
libopenexr-dev libopenjp2-7-dev libosmgpsmap-1.0-dev libpango1.0-dev \
libpng-dev libpugixml-dev librsvg2-dev libsaxon-java libsecret-1-dev \
libsoup2.4-dev libsqlite3-dev libtiff5-dev libwebp-dev libx11-dev \
libxml2-dev libxml2-utils make ninja-build perl po4a python3-jsonschema \
xsltproc zlib1g-dev libxslt1-dev gtk+-3.0 libsoup2.4 libtiff-dev libgtk-3-bin && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN dpkg-divert --add --rename --divert /usr/bin/ld.original /usr/bin/ld && \
ln -s /usr/bin/ld.gold /usr/bin/ld
RUN rm -rf /var/lib/apt/lists/* && apt-get update && \
apt-get install clang-$LLVM_VER libclang-common-$LLVM_VER-dev \
llvm-$LLVM_VER-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN rm -rf /var/lib/apt/lists/* && apt-get update && \
apt-get install default-jdk-headless default-jre-headless docbook \
docbook-xml docbook-xsl docbook-xsl-saxon fop gnome-doc-utils imagemagick \
libsaxon-java xsltproc && apt-get clean && rm -rf /var/lib/apt/lists/*
# Build and install darktable
RUN git clone https://github.com/darktable-org/darktable.git
WORKDIR "/src/darktable"
RUN git fetch --all --tags --prune && git checkout tags/release-$DARKTABLE_VERSION
RUN git submodule init && git submodule update
RUN ./build.sh --prefix /opt/darktable --build-type Release --install
# Copy darktable header files
WORKDIR "/src/darktable/src"
RUN mkdir -p /opt/darktable/include/darktable
RUN find . -name '*.h' -exec cp --parents \{\} /opt/darktable/include/darktable \;
# Configure shell environment
WORKDIR "/opt/darktable"
ENV PATH /opt/darktable/bin:$PATH
# Configure broadwayd
ENV GDK_BACKEND broadway
ENV BROADWAY_DISPLAY :5
EXPOSE 8080
CMD broadwayd -p 8080 -a 0.0.0.0 :5

View file

@ -0,0 +1,7 @@
version: '3.3'
services:
darktable:
image: photoprism/darktable:latest
ports:
- 8080:8080

View file

@ -0,0 +1,52 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)
mQINBFE9lCwBEADi0WUAApM/mgHJRU8lVkkw0CHsZNpqaQDNaHefD6Rw3S4LxNmM
EZaOTkhP200XZM8lVdbfUW9xSjA3oPldc1HG26NjbqqCmWpdo2fb+r7VmU2dq3NM
R18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ht3kAEQEAAYkCHwQYAQIACQUCUT2ULAIbDAAKCRAVz00Yr090IbhWEADbr50X
OEXMIMGRLe+YMjeMX9NG4jxs0jZaWHc/WrGR+CCSUb9r6aPXeLo+45949uEfdSsB
pbaEdNWxF5Vr1CSjuO5siIlgDjmT655voXo67xVpEN4HhMrxugDJfCa6z97P0+ML
PdDxim57uNqkam9XIq9hKQaurxMAECDPmlEXI4QT3eu5qw5/knMzDMZj4Vi6hovL
wvvAeLHO/jsyfIdNmhBGU2RWCEZ9uo/MeerPHtRPfg74g+9PPfP6nyHD2Wes6yGd
oVQwtPNAQD6Cj7EaA2xdZYLJ7/jW6yiPu98FFWP74FN2dlyEA2uVziLsfBrgpS4l
tVOlrO2YzkkqUGrybzbLpj6eeHx+Cd7wcjI8CalsqtL6cG8cUEjtWQUHyTbQWAgG
5VPEgIAVhJ6RTZ26i/G+4J8neKyRs4vz+57UGwY6zI4AB1ZcWGEE3Bf+CDEDgmnP
LSwbnHefK9IljT9XU98PelSryUO/5UPw7leE0akXKB4DtekToO226px1VnGp3Bov
1GBGvpHvL2WizEwdk+nfk8LtrLzej+9FtIcq3uIrYnsac47Pf7p0otcFeTJTjSq3
krCaoG4Hx0zGQG2ZFpHrSrZTVy6lxvIdfi0beMgY6h78p6M9eYZHQHc02DjFkQXN
bXb5c6gCHESH5PXwPU4jQEE7Ib9J6sbk7ZT2Mw==
=j+4q
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -2,34 +2,45 @@ FROM ubuntu:18.04
LABEL maintainer="Michael Mayer <michael@liquidbytes.net>"
ENV DEBIAN_FRONTEND noninteractive
# Configure apt-get
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry
RUN echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends
RUN echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes
RUN echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissin
# Install dev / build dependencies
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 \
software-properties-common \
rsync \
unzip \
g++ \
gcc \
libc6-dev \
gpg-agent \
apt-utils \
make \
nano \
wget \
git \
mysql-client
RUN apt-get update && apt-get upgrade && \
apt-get install \
build-essential \
curl \
libfreetype6-dev \
libhdf5-serial-dev \
libpng-dev \
libzmq3-dev \
pkg-config \
software-properties-common \
rsync \
unzip \
g++ \
gcc \
libc6-dev \
gpg-agent \
apt-utils \
make \
nano \
wget \
git \
mysql-client \
libgtk-3-bin
# Install darktable (RAW to JPEG converter)
RUN add-apt-repository ppa:pmjdebruijn/darktable-release && \
apt-get update && \
apt-get install -y --no-install-recommends darktable && \
apt-get upgrade -y
apt-get install darktable && \
apt-get upgrade
# Install TensorFlow C library
RUN curl -L \
@ -42,7 +53,7 @@ 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
RUN apt-get install nodejs
# Install YARN (Package Manager)
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
@ -83,11 +94,17 @@ RUN env GO111MODULE=off /usr/local/go/bin/go get golang.org/x/tools/cmd/goimport
ENV NODE_ENV production
ENV YARN_CACHE_FOLDER /root/.cache/yarn
# Configure broadwayd (HTML5 display server)
# Command: broadwayd -p 8080 -a 0.0.0.0 :5
ENV GDK_BACKEND broadway
ENV BROADWAY_DISPLAY :5
# Set up project directory
WORKDIR "/go/src/github.com/photoprism/photoprism"
# Expose HTTP port
# Expose HTTP port plus 8080 for broadwayd (not running by default)
EXPOSE 80
EXPOSE 8080
# Keep container running (services can be started manually using a terminal)
CMD tail -f /dev/null

View file

@ -1,4 +1,4 @@
FROM photoprism/development:20181108 as build
FROM photoprism/development:20181112 as build
# Set up project directory
WORKDIR "/go/src/github.com/photoprism/photoprism"

View file

@ -1,4 +1,4 @@
FROM photoprism/development:20181108
FROM photoprism/development:20181112
# Install Python and TensorFlow
RUN apt-get update && apt-get install -y --no-install-recommends \

2
go.mod
View file

@ -39,7 +39,7 @@ require (
github.com/ugorji/go v1.1.1 // indirect
github.com/urfave/cli v1.20.0
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd // indirect
golang.org/x/image v0.0.0-20181107040041-fe2fa19765cb
golang.org/x/image v0.0.0-20181109232246-249dc8530c0e
golang.org/x/net v0.0.0-20181108082009-03003ca0c849 // indirect
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect

4
go.sum
View file

@ -79,8 +79,8 @@ github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd h1:VtIkGDhk0ph3t+THbvXHfMZ8QHgsBO39Nh52+74pq7w=
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/image v0.0.0-20181107040041-fe2fa19765cb h1:bgVKvF9JMEKw/zhQupMlJd2M8D2v80fqKZDZbtkUCpI=
golang.org/x/image v0.0.0-20181107040041-fe2fa19765cb/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/image v0.0.0-20181109232246-249dc8530c0e h1:tKeLpam+QnQXh80ue3KM7AcmYlUyEn8j00wnh3XphNk=
golang.org/x/image v0.0.0-20181109232246-249dc8530c0e/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181108082009-03003ca0c849 h1:FSqE2GGG7wzsYUsWiQ8MZrvEd1EOyU3NCF0AW3Wtltg=
golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=

View file

@ -52,7 +52,7 @@ var GlobalFlags = []cli.Flag{
},
cli.StringFlag{
Name: "database-driver",
Usage: "database `DRIVER` (mysql, mssql, postgres or sqlite)",
Usage: "database `DRIVER` (mysql, postgres or sqlite)",
Value: "mysql",
EnvVar: "PHOTOPRISM_DATABASE_DRIVER",
},

View file

@ -1,19 +1,38 @@
#!/usr/bin/env bash
VERSION=`date -u +0.%Y%m%d.%H%M%S`
BRANCH=`git rev-parse --abbrev-ref HEAD`
BUILD_DATE=`date -u +%y%m%d`
VERSION=`git describe --always`
if [ -z "$1" ] || [ -z "$2" ]; then
if [[ -z $1 ]] || [[ -z $2 ]]; then
echo "Please provide build mode and output file name" 1>&2
exit 1
fi
if [ $1 == "debug" ]; then
if [[ $OS == "Windows_NT" ]]; then
OPERATING_SYSTEM=win32
if [[ $PROCESSOR_ARCHITEW6432 == "AMD64" ]]; then
PROCESSOR=amd64
else
if [[ $PROCESSOR_ARCHITECTURE == "AMD64" ]]; then
PROCESSOR=amd64
fi
if [[ $PROCESSOR_ARCHITECTURE == "x86" ]]; then
PROCESSOR=ia32
fi
fi
else
OPERATING_SYSTEM=`uname -s`
PROCESSOR=`uname -p`
fi
if [[ $1 == "debug" ]]; then
echo "Building development binary..."
go build -ldflags "-X main.version=${VERSION}-${BRANCH}" -o $2 cmd/photoprism/photoprism.go
go build -ldflags "-X main.version=${BUILD_DATE}-${VERSION}-${OPERATING_SYSTEM}-${PROCESSOR}-DEBUG" -o $2 cmd/photoprism/photoprism.go
du -h $2
echo "Done."
else
echo "Building production binary..."
go build -ldflags "-s -w -X main.version=${VERSION}" -o $2 cmd/photoprism/photoprism.go
go build -ldflags "-s -w -X main.version=${BUILD_DATE}-${VERSION}-${OPERATING_SYSTEM}-${PROCESSOR}" -o $2 cmd/photoprism/photoprism.go
du -h $2
echo "Done."
fi

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
if [ -z "$1" ] || [ -z "$2" ]; then
if [[ -z $1 ]] || [[ -z $2 ]]; then
echo "Please provide a container image name and version" 1>&2
exit 1
else

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
if [ -z "$DOCKER_PASSWORD" ] || [ -z "$DOCKER_USERNAME" ]; then
if [[ -z $DOCKER_PASSWORD ]] || [[ -z $DOCKER_USERNAME ]]; then
echo "DOCKER_PASSWORD and DOCKER_USERNAME not set in your environment";
exit 1
fi
@ -8,7 +8,7 @@ fi
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
if [ -z "$1" ] || [ -z "$2" ]; then
if [[ -z $1 ]] || [[ -z $2 ]]; then
echo "Please provide a container image name and version" 1>&2
exit 1
else