Hello All, I am trying to acheive the following. ...
# general
w
Hello All, I am trying to acheive the following. Please let me know if this is possible 1. Create a python docker using pulumi 2. Deploy this docker image on to an EC2 instance can this be done is the same script or is it better to use a different CI/CD for the docker build and a separate one for Infra build.
b
Hi @witty-spring-28765 This can indeed be done with Pulumi - https://github.com/pulumi/examples/tree/master/aws-py-fargate
That should get you some of the way - the docker build and the ECR repo. Then you would need to pass the docker container name to a userdata script on an instance and run your docker pill and run commands there
This example will show you how to pass userdata https://github.com/pulumi/examples/tree/master/aws-py-webserver
w
Hello Paul, many thanks for the response. The fargate example provided gets the image from an ECR. But I am trying to keep the docker code build and the deployment in the same stack of pulumi. Or do I have to have two separate items? I found this example https://github.com/pulumi/pulumi-docker/blob/master/examples/aws-py but this seems to be focused on ECR, is there no integration to push builds to dockerhub for example?
b
Oh I apologise - I didn’t realise that wasn’t in the example
One second
This will show you how to use Pulumi to build the container
And as part of that repository you can push to ECR
w
thanks Paul, but just running this example without changes, where does the image get pushed to the pulumi app ?
b
By default it will keep the image local due to SkipPush: true
But you can look at the api and see that it allows you to push to a registry @witty-spring-28765
w
Thanks Paul, it work like a charm. Is there a way to avoid the SHA being tagged to ECR