diff --git a/Dockerfile b/Dockerfile index 2cb716f20..a2521474a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM photoprism/development:20201004 +FROM photoprism/development:20201020 # Set up project directory WORKDIR "/go/src/github.com/photoprism/photoprism" diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index 701869762..2253fc4b7 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -58,7 +58,8 @@ RUN apt-get update && apt-get upgrade && \ seccomp \ libseccomp-dev \ libseccomp2 \ - fonts-roboto + fonts-roboto \ + sudo # Install Chromium Browser via .deb RUN add-apt-repository -y ppa:xalt7x/chromium-deb-vaapi @@ -101,12 +102,12 @@ RUN npm install --unsafe-perm=true --allow-root -g npm testcafe chromedriver RUN npm config set cache ~/.cache/npm # Install Go -ENV GOLANG_VERSION 1.15.2 +ENV GOLANG_VERSION 1.15.3 RUN set -eux; \ \ url="https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz"; \ wget -O go.tgz "$url"; \ - echo "b49fda1ca29a1946d6bb2a5a6982cf07ccd2aba849289508ee0f9918f6bb4552 *go.tgz" | sha256sum -c -; \ + echo "010a88df924a81ec21b293b5da8f9b11c176d27c0ee3962dc1738d2352d3c02d *go.tgz" | sha256sum -c -; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ export PATH="/usr/local/go/bin:$PATH"; \ @@ -138,6 +139,7 @@ RUN env GO111MODULE=off /usr/local/go/bin/go get -u github.com/psampaz/go-mod-ou RUN useradd photoprism -m -d /photoprism && \ chmod 777 /photoprism && \ echo "alias go=richgo" > /photoprism/.bash_aliases && \ + echo "photoprism ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \ chown -R photoprism:photoprism /photoprism && \ find /go -type d -print0 | xargs -0 chmod 777 && \ find /go -type f -print0 | xargs -0 chmod a+rw diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 000000000..0882e60ac --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +if [[ ${UMASK} ]]; then + umask "${UMASK}" +fi + +if [[ ${UID} ]] && [[ ${GID} ]] && [[ ${UID} != "0" ]] && [[ $(id -u) = "0" ]]; then + groupadd -f -g "${GID}" "${GID}" + usermod -o -u "${UID}" -g "${GID}" photoprism + gosu "${UID}:${GID}" "$@" & +elif [[ ${UID} ]] && [[ ${UID} != "0" ]] && [[ $(id -u) = "0" ]]; then + usermod -o -u "${UID}" photoprism + gosu "${UID}" "$@" & +else + "$@" & +fi + +PID=$! + +trap "kill $PID" INT TERM +wait \ No newline at end of file diff --git a/docker/photoprism/Dockerfile b/docker/photoprism/Dockerfile index e79ec971b..7834e6d4e 100644 --- a/docker/photoprism/Dockerfile +++ b/docker/photoprism/Dockerfile @@ -1,4 +1,4 @@ -FROM photoprism/development:20201004 as build +FROM photoprism/development:20201020 as build # Set up project directory WORKDIR "/go/src/github.com/photoprism/photoprism" @@ -117,7 +117,7 @@ RUN photoprism -v EXPOSE 2342 # Configure entrypoint -COPY --chown=root:root /docker/photoprism/entrypoint.sh /entrypoint.sh +COPY --chown=root:root /docker/entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] # Run server diff --git a/docker/photoprism/arm64/Dockerfile b/docker/photoprism/arm64/Dockerfile index 593ce717d..e85822de8 100644 --- a/docker/photoprism/arm64/Dockerfile +++ b/docker/photoprism/arm64/Dockerfile @@ -73,12 +73,12 @@ RUN npm install --unsafe-perm=true --allow-root -g npm RUN npm config set cache ~/.cache/npm # Install Go -ENV GOLANG_VERSION 1.15.2 +ENV GOLANG_VERSION 1.15.3 RUN set -eux; \ \ url="https://golang.org/dl/go${GOLANG_VERSION}.linux-arm64.tar.gz"; \ wget -O go.tgz "$url"; \ - echo "c8ec460cc82d61604b048f9439c06bd591722efce5cd48f49e19b5f6226bd36d *go.tgz" | sha256sum -c -; \ + echo "b8b88a87ada918ef5189fa5938ef4c46a4f61952a34317612aaac705f4275f80 *go.tgz" | sha256sum -c -; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ export PATH="/usr/local/go/bin:$PATH"; \ @@ -208,7 +208,7 @@ RUN photoprism -v EXPOSE 2342 # Configure entrypoint -COPY --chown=root:root /docker/photoprism/entrypoint.sh /entrypoint.sh +COPY --chown=root:root /docker/entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] # Run server diff --git a/docker/photoprism/entrypoint.sh b/docker/photoprism/entrypoint.sh deleted file mode 100755 index ac9437ae7..000000000 --- a/docker/photoprism/entrypoint.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -if [[ ${UMASK} ]]; then - umask ${UMASK} -fi - -if [[ ${UID} ]] && [[ ${GID} ]] && [[ ${UID} != "0" ]] && [[ $(id -u) = "0" ]]; then - groupadd -f -g ${GID} ${GID} - usermod -o -u ${UID} -g ${GID} photoprism - gosu ${UID}:${GID} "$@" & -elif [[ ${UID} ]] && [[ ${UID} != "0" ]] && [[ $(id -u) = "0" ]]; then - usermod -o -u ${UID} photoprism - gosu ${UID} "$@" & -else - "$@" & -fi - -PHOTOPRISM_PID=$! - -trap "kill $PHOTOPRISM_PID" INT TERM -wait \ No newline at end of file