Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Docker from Travis to AWS (or any other SSH able server)

My deployment process is missing one important piece. To push the code up to the server.

I'm banging my head whether to:

1 - Create/Build the Docker image on Travis and then somehow push it to AWS

OR

2 - Try to ssh (from travis script) into my AWS and run a command set there, including the Docker image build and initialization.

I'm definitively in doubt and I see problems in both solutions proposed above. What would be the usual mechanism here?

like image 810
Javier Avatar asked Nov 26 '25 16:11

Javier


1 Answers

I will answer myself here:

1 is not a good idea, it's definitively wrong. If you build the Docker container on the Travis side, and (think you can) transfer it to AWS, you'd be overkilling the network and your deployment could take ages.

2 is more or less the way to follow (there could be others). In my case I ssh'd from travis into my server and executed a set of commands remotely, among them docker build, docker run.

It's good to mention that whatever command you remotely execute in your server, the output is beautifully transferred into your Travis output.

like image 59
Javier Avatar answered Nov 29 '25 17:11

Javier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!