os: linux language: shell branches: only: - universal-docker services: - docker env: global: - DOCKERHUB="linuxserver/mods" - BASEIMAGE="universal" - MODNAME="docker" jobs: include: - stage: PR-BuildImage if: (type IN (pull_request)) script: # Build image - docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} . - stage: BuildImage if: (NOT (type IN (pull_request))) script: # Set version - if [ -z ${COMPOSE_TAG+x} ]; then COMPOSE_TAG=$(curl -sX GET "https://api.github.com/repos/linuxserver/docker-docker-compose/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]'); fi - if [ -z ${COMPOSE_ALPINE_TAG+x} ]; then COMPOSE_ALPINE_TAG=$(curl -sX GET "https://api.github.com/repos/linuxserver/docker-docker-compose/releases" | jq -r 'first(.[] | select(.prerelease==true)) | .tag_name'); fi - COMPOSE_VERSION=$(echo "$COMPOSE_TAG" | sed 's|-ls.*||g') - COMPOSE_ALPINE_VERSION="$(echo ${COMPOSE_ALPINE_TAG} | sed 's|-ls.*||g' | sed 's|alpine-||g')" - if [ "$COMPOSE_VERSION" != "$COMPOSE_ALPINE_VERSION" ]; then echo "ubuntu and alpine versions are different; exiting!" && travis_terminate 1; else echo "ubuntu and alpine versions are the same, continuing with build"; fi # Build image - docker build --no-cache --build-arg COMPOSE_TAG=${COMPOSE_TAG} --build-arg COMPOSE_ALPINE_TAG=${COMPOSE_ALPINE_TAG} -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}-${TRAVIS_COMMIT} . - docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION} - docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} # Login to DockerHub - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin # Push all of the tags - docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION}-${TRAVIS_COMMIT} - docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${COMPOSE_VERSION} - docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}