pip install -r requirements.txtpip install "pymongo[srv]"- set
BOT_TOKENenv var - set
MONGODB_URLenv var pybabel extract --input-dirs=. --ignore-dirs=venv -o locales/bot.pot --version=2.2 --project=AvezorBot -k __:1,2 -k ___ && pybabel update -d locales -D bot -i locales/bot.potpybabel compile -d locales -D bot- run
python run.py
Fill .env file, then
use docker-compose up or docker build .
This workflow will build and push a new container image to Amazon ECR, and then will deploy a new task definition to Amazon ECS, when there is a push to the master branch.
To use this workflow, you will need to complete the following set-up steps:
-
Create an ECR repository to store your images. For example:
aws ecr create-repository --repository-name my-ecr-repo --region us-east-2. Replace the value of theECR_REPOSITORYenvironment variable in the workflow below with your repository's name. Replace the value of theAWS_REGIONenvironment variable in the workflow below with your repository's region. -
Create an ECS task definition, an ECS cluster, and an ECS service. For example, follow the Getting Started guide on the ECS console: https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun Replace the value of the
ECS_SERVICEenvironment variable in the workflow below with the name you set for the Amazon ECS service. Replace the value of theECS_CLUSTERenvironment variable in the workflow below with the name you set for the cluster. -
Store your ECS task definition as a JSON file in your repository. The format should follow the output of
aws ecs register-task-definition --generate-cli-skeleton. Replace the value of theECS_TASK_DEFINITIONenvironment variable in the workflow below with the path to the JSON file. Replace the value of theCONTAINER_NAMEenvironment variable in the workflow below with the name of the container in thecontainerDefinitionssection of the task definition. -
Store an IAM user access key in GitHub Actions secrets named
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY. See the documentation for each action used below for the recommended IAM policies for this IAM user, and best practices on handling the access key credentials. -
Add
BOT_TOKENandMONGODB_URLto GitHub action secrets