diff options
-rw-r--r-- | .travis.yml | 17 | ||||
-rw-r--r-- | Pipfile | 3 | ||||
-rw-r--r-- | bot/cogs/spookyreact.py | 2 | ||||
-rw-r--r-- | docker/Dockerfile | 15 | ||||
-rwxr-xr-x | docker/build.sh | 21 | ||||
-rw-r--r-- | docker/docker-compose.yml | 11 | ||||
-rw-r--r-- | tox.ini | 2 |
7 files changed, 67 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..ae1d7653 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: python + +python: + - "3.7-dev" + +sudo: required + +services: + - docker + +install: + - pip install flake8 pipenv salt-pepper + - pipenv install --deploy + +script: + - pipenv run lint + - bash docker/build.sh @@ -18,4 +18,5 @@ name = "pypi" python_version = "3.7" [scripts] -start = "python -m bot"
\ No newline at end of file +start = "python -m bot" +lint = "flake8 bot" diff --git a/bot/cogs/spookyreact.py b/bot/cogs/spookyreact.py index f5534626..2652a60e 100644 --- a/bot/cogs/spookyreact.py +++ b/bot/cogs/spookyreact.py @@ -1,5 +1,3 @@ -from discord.ext import commands - SPOOKY_TRIGGERS = { 'spooky': "\U0001F47B", 'skeleton': "\U0001F480", diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..9c4406bf --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.6-alpine3.7 +RUN apk add --update tini git + +RUN mkdir /bot +COPY . /bot +WORKDIR /bot + +ENV LIBRARY_PATH=/lib:/usr/lib + +RUN pip install pipenv +RUN pipenv install --deploy --system + +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["python", "-m", "bot"] + diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 00000000..ee46bf40 --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Build and deploy on master branch +if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then + echo "Connecting to docker hub" + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + + echo "Building image" + docker build -t pythondiscord/hacktober-bot:latest -f docker/Dockerfile . + + echo "Pushing image" + docker push pythondiscord/hacktober-bot:latest + + echo "Deploying on server" + pepper ${SALTAPI_TARGET} state.apply docker/hacktoberbot --out=no_out --non-interactive &> /dev/null + + echo "Deploying container" + curl -H "token: $AUTODEPLOY_TOKEN" $AUTODEPLOY_WEBHOOK +else + echo "Skipping deploy" +fi diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..0a802ddc --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3" +services: + dumbo: + image: pythondiscord/hacktober-bot:latest + container_name: hacktoberbot + + restart: always + + environment: + - HACKTOBERBOT_TOKEN + @@ -1,6 +1,6 @@ [flake8] max-line-length=120 -application_import_names=proj +application_import_names=bot ignore=P102,B311,W503,E226,S311 exclude=__pycache__, venv, .venv, tests import-order-style=pycharm |