Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-deploy GraphQL docker image #4079

Merged
merged 2 commits into from
Feb 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 34 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
language: node_js
node_js:
- "6"
- "8"
sudo: required

services:
- docker

os:
- linux

os: [linux]
dist: trusty
sudo: required
cache:
yarn: true

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
jobs:
include:
- stage: build and test
if: type = pull_request
language: node_js
node_js:
- '6'
- '8'
cache:
yarn: true
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
install:
- yarn run bootstrap
script:
- yarn test

- stage: www graphql docker image build and push
if: (NOT type = pull_request) AND branch = master
env:
- DOCKER_USER=mikeallanson
- secure: J8daWiar248dPWwrutZd83CeSif/+rMjB9hSOjq0pQDNj7QcOKjUwLsv6yMDJAcQCAAyobwRQTNYANGXmvQsi5ZppZe/P/enDPD/ZEPz3XkvxYYbXC7TNKVp8bnvYTWu6qO9ljkMsKGttsqaz+MyTx2MjV9pJhkmw2rfQ5iVn/80bORaCCMDcSB2ud/jLN+AVBFNMDUVEL9RnAXTq+CyQmSLvlvmJNCu9CXnb/Kt+IcbqswTjre/V2lVkzcXEvUYd0F9la3bsGVVQ9vBd3IumSIGnSOxD91DLUOeuh5K7FJxPoqqwM+bCn4zZWtQMOGpPDoYYllVejFHC16g/FBa6uC455OvqeS6fSCRXr9bqDxDLPhn7IyDAuG2jXps++sbd2RA8eXq8IGA4AqtTf4smiIXbOu3p3d2n9ww4Z/NgRpLHYRFcVwjG92okVN4by7n1+kr7wGx+alCkHTMDrLkkeZ0AEJphaxAH+TxP+SvCFY1z/OyNM0YzICrLXjf2w60Xz4wE563yUM8OLFm4GbeM33eQYRErTLADG9JtGDev+L5tS/Vo8+KGkL3creY7f9BgsNyfxbQbv84X7f+vSPlzl6u8V9EuVA80+5hE7artRtM+BxiT5pGM1983+QK2CPv4EptMYRa0EjlVbxyrfVYF22lsAqqgVApZGGneUxB0cQ= # DOCKER_PASS
before_install:
- chmod +x scripts/www-graphql-docker-push.sh
script:
- ./scripts/www-graphql-docker-push.sh

install:
- yarn run bootstrap

script:
- yarn test
19 changes: 19 additions & 0 deletions scripts/www-graphql-docker-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

# Path to here
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# Prepare
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
export REPO=mikeallanson/gatsby-graphql
export TAG=latest

# Build
# Build the Dockerfile located at ../, using ../ as the context directory
docker build -t "$REPO":"$TRAVIS_COMMIT" -f "$DIR"/../Dockerfile "$DIR"/../

docker tag "$REPO":"$TRAVIS_COMMIT" "$REPO":"$TAG"
docker tag "$REPO":"$TRAVIS_COMMIT" "$REPO":travis-"$TRAVIS_BUILD_NUMBER"

# Push
docker push "$REPO"