From 0345bc9ef7887d201e34fadbf99664acfcc5f25e Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Mon, 31 Aug 2020 12:04:05 +1000 Subject: [PATCH] Make travis build and push docker images (#772) --- .travis.yml | 14 ++++++++++++++ docker/ci/x86_64/Dockerfile | 25 +++++++++++++++++++++++++ docker/ci/x86_64/README.md | 1 + docker/ci/x86_64/docker_push.sh | 9 +++++++++ 4 files changed, 49 insertions(+) create mode 100644 docker/ci/x86_64/Dockerfile create mode 100644 docker/ci/x86_64/README.md create mode 100644 docker/ci/x86_64/docker_push.sh diff --git a/.travis.yml b/.travis.yml index 79e7995e8..855a7eae0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,6 +55,12 @@ deploy: on: repo: stashapp/stash branch: develop + # docker image build for develop release + - provider: script + script: bash ./docker/ci/x86_64/docker_push.sh development-x86_64 + on: + repo: stashapp/stash + branch: develop # official master release - only build when tagged - provider: releases api_key: @@ -78,3 +84,11 @@ deploy: tags: true # make sure we don't release using the latest_develop tag condition: $TRAVIS_TAG != latest_develop + # docker image build for master release + - provider: script + script: bash ./docker/ci/x86_64/docker_push.sh latest + on: + repo: stashapp/stash + tags: true + # make sure we don't release using the latest_develop tag + condition: $TRAVIS_TAG != latest_develop diff --git a/docker/ci/x86_64/Dockerfile b/docker/ci/x86_64/Dockerfile new file mode 100644 index 000000000..54d1bec4f --- /dev/null +++ b/docker/ci/x86_64/Dockerfile @@ -0,0 +1,25 @@ + +# must be built from /dist directory + +FROM ubuntu:18.04 as prep +LABEL MAINTAINER="https://discord.gg/Uz29ny" + +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 --http1.1 -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 apt-get update && apt-get -y install ca-certificates +COPY --from=prep /ffmpeg/ffmpeg /ffmpeg/ffprobe /usr/bin/ +COPY /stash-linux /usr/bin/stash + +EXPOSE 9999 +CMD ["stash"] diff --git a/docker/ci/x86_64/README.md b/docker/ci/x86_64/README.md new file mode 100644 index 000000000..e6dc0abcf --- /dev/null +++ b/docker/ci/x86_64/README.md @@ -0,0 +1 @@ +This dockerfile is used by travis to build the stash image. It must be run after cross-compiling - that is, `stash-linux` must exist in the `dist` directory. This image must be built from the `dist` directory. \ No newline at end of file diff --git a/docker/ci/x86_64/docker_push.sh b/docker/ci/x86_64/docker_push.sh new file mode 100644 index 000000000..ae44472be --- /dev/null +++ b/docker/ci/x86_64/docker_push.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +DOCKER_TAG=$1 + +# must build the image from dist directory +echo docker build -t stashapp/stash:$DOCKER_TAG -f ./docker/ci/x86_64/Dockerfile ./dist + +echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin +echo docker push stashapp/stash:$DOCKER_TAG