Modifying the docker file to install docker on a separate step so we can cache that bit to speed up testing. also adding a script that will run some quick tests

This commit is contained in:
Luke Robles 2017-08-08 15:55:01 -07:00
parent 8afdad88b4
commit cbf3f58102
3 changed files with 13 additions and 3 deletions

View File

@ -1,7 +1,8 @@
FROM python:3.6.2-slim
RUN apt-get update && apt-get install -y curl &&\
pip3 install requests discord.py docker pybooru && \
RUN apt-get update && apt-get install curl -y &&\
curl -Lks get.docker.com | bash
RUN pip install requests discord.py docker pybooru termcolor
ADD app /app
CMD python app/dragon-bot.py

View File

@ -6,6 +6,7 @@ import help_methods
import discord
import docker
from pybooru import Danbooru
from termcolor import colored
# Client object
client = discord.Client()
@ -260,7 +261,7 @@ async def on_message(message):
# Check if there is a command line argument after script
if len(sys.argv) > 1:
print("If you're seeing this, the python compiled")
print(colored("If you're seeing this, the python compiled", 'green'))
sys.exit()
token = "MzM5NDQ2NTgwMTU3MzQ5ODg4.DFkGYg.z-XD17nFP4rtBq-YsNbOJHuBWfQ" # get from the bot page. must be a bot, not a discord app

8
test_container.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
printf "\nStarting tests\n"
printf "Building docker container\n"
docker build -t tests .
printf "Running docker container to test your python code\n"
docker run --rm tests python /app/dragon-bot.py test