diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c9f7083 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ + +# Created by https://www.gitignore.io/api/pycharm+all +# Edit at https://www.gitignore.io/?templates=pycharm+all + +### PyCharm+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### PyCharm+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +# End of https://www.gitignore.io/api/pycharm+all diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f078b9b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +language: python + +python: + - "3.7" + +services: + - postgresql + - docker + +deploy: + provider: script + script: bash deploy.sh + skip_cleanup: true + on: + all_branches: true + condition: $TRAVIS_BRANCH =~ ^(dev|testing|demo|training|staging|master|rrt\/.*)$ + +notifications: + email: + on_success: change + on_failure: always + recipients: + - dan@sartography.com diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..841d788 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.7-slim + +WORKDIR /app +COPY Pipfile Pipfile.lock /app/ + +RUN set -xe \ + && pip install pipenv \ + && apt-get update -q \ + && apt-get install -y -q \ + gcc python3-dev libssl-dev \ + curl postgresql-client git-core \ + gunicorn3 postgresql-client diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..1b11817 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +function branch_to_tag () { + if [ "$1" == "latest" ]; then echo "production"; else echo "$1" ; fi +} + +REPO="sartography/cr-connect-workflow" +TAG=$(branch_to_tag "$TRAVIS_BRANCH") + +# Build and push Docker image to Docker Hub +echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1 +docker build -f Dockerfile -t "$REPO:$TAG" . || exit 1 +docker push "$REPO" || exit 1