From 83ee83c2facff5c8dd64d4ea403e85e59e5c87ca Mon Sep 17 00:00:00 2001 From: Leopere <1068374+Leopere@users.noreply.github.com> Date: Wed, 24 Apr 2019 13:10:26 -0400 Subject: [PATCH] Dockerfile for production. (#44) * Stealing good ideas from DockSTARTer * Pushing an example WIP * Actually ran and debugged container and it works now. TODO: We need configurability for this to be more useful. * Prepped docker-compose for if we get these envvars coded in. * Removed unnecessary start.sh * Removed env.example * Fixed internal directory to conform more. Resovles https://github.com/stashapp/stash/pull/44#issuecomment-485060195 * Logging options need quotes. * I decided to use architecture tags since go-releaser can do multiple architectures. * Compose version version: '3.4' * No relative pathing on container side of volume --- docker/production/docker-compose.yml | 31 ++++++++++++++++++++++++++++ docker/production/x86_64/Dockerfile | 21 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 docker/production/docker-compose.yml create mode 100644 docker/production/x86_64/Dockerfile diff --git a/docker/production/docker-compose.yml b/docker/production/docker-compose.yml new file mode 100644 index 000000000..3d9bffa89 --- /dev/null +++ b/docker/production/docker-compose.yml @@ -0,0 +1,31 @@ +# APPNICENAME=Stash +# APPDESCRIPTION=An organizer for your porn, written in Go +version: '3.4' +services: + stash: + image: stashapp/stash:x86_64 + restart: unless-stopped + ports: + - "9999:9999" + logging: + driver: "json-file" + options: + max-file: "10" + max-size: "200k" + environment: + - STASH_STASH=/data/ + - STASH_GENERATED=/generated/ + - STASH_METADATA=/metadata/ + - STASH_CACHE=/cache/ + volumes: + - /etc/localtime:/etc/localtime:ro + ## Keep configs here. + - ./config:/root/.stash + ## Point this at your collection. + - ./data:/data + ## This is where pre-generated transcodes live. + - ./transcodes:/transcodes + ## This is where your stash's metadata lives + - ./metadata:/metadata + ## Any other cache content. + - ./cache:/cache diff --git a/docker/production/x86_64/Dockerfile b/docker/production/x86_64/Dockerfile new file mode 100644 index 000000000..cea0faad5 --- /dev/null +++ b/docker/production/x86_64/Dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:18.04 as prep +LABEL MAINTAINER="leopere [at] nixc [dot] us" + +RUN apt-get update && \ + apt-get -y install curl xz-utils && \ + apt-get autoclean -y && \ + rm -rf /var/lib/apt/lists/* +WORKDIR / +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN curl -L -o /stash $(curl -s https://api.github.com/repos/stashapp/stash/releases | grep -F 'stash-linux' | grep download | head -n 1 | cut -d'"' -f4) && \ + chmod +x /stash && \ + curl -o /ffmpeg.tar.xz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \ + tar xf /ffmpeg.tar.xz && \ + rm ffmpeg.tar.xz && \ + mv /ffmpeg*/ /ffmpeg/ + +FROM ubuntu:18.04 as app +RUN adduser stash --gecos GECOS --shell /bin/bash --disabled-password --home /home/stash +COPY --from=prep /stash /ffmpeg/ffmpeg /ffmpeg/ffprobe /usr/bin/ +EXPOSE 9998 +CMD ["stash"]