-
-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds dockerfile that uses pipenv (#60)
Dockerfile and new deploy flow that builds the container in travis
- Loading branch information
1 parent
e3306b3
commit 54369f6
Showing
7 changed files
with
54 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM pythondiscord/bot-base:latest | ||
|
||
ENV PIPENV_VENV_IN_PROJECT=1 | ||
ENV PIPENV_IGNORE_VIRTUALENVS=1 | ||
ENV PIPENV_NOSPIN=1 | ||
ENV PIPENV_HIDE_EMOJIS=1 | ||
|
||
RUN pip install pipenv | ||
|
||
COPY . /bot | ||
WORKDIR /bot | ||
|
||
RUN pipenv sync | ||
|
||
ENTRYPOINT ["/sbin/tini", "--"] | ||
CMD ["pipenv", "run", "python", "-m", "bot"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM python:3.6-alpine | ||
|
||
RUN apk add --update tini | ||
RUN apk add --update build-base | ||
RUN apk add --update libffi-dev | ||
|
||
# usage: FROM pythondiscord/bot-base:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import os | ||
|
||
import requests | ||
|
||
url = os.environ.get("AUTODEPLOY_WEBHOOK") | ||
token = os.environ.get("AUTODEPLOY_TOKEN") | ||
result = requests.get(url=url, headers={'token': token}) | ||
print(result.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/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/bot:latest . | ||
|
||
echo "Pushing image" | ||
docker push pythondiscord/bot:latest | ||
|
||
echo "Deploying container" | ||
pipenv run python scripts/deploy.py | ||
fi |