Reputation: 655
I prepared a repository with a python script which I run in a docker container. The Dockerfile is also in the repository.
I tried ECS + Batch jobs, but it seems overcomplicated for such a task.
I would like to use an AWS service that clones this repository, builds the container and runs the script. How can I achieve that?
Upvotes: 0
Views: 640
Reputation: 9847
You can start an EC2 instance that will run this script (assuming you use Amazon Linux or Centos AMI) at startup, using User Data:
#!/bin/bash
yum update -y
yum install -y docker git
service docker start
git clone https://github.com/yourcompany/yourproject myproject
cd myproject
docker build -t my-docker-image .
docker run my-docker-image
Upvotes: 1