I had a couple of WordPress sites I wanted to dockerize and move over to my new server. This is the configuration I used to deploy them to my new server as described here.
I’m using the official
mysql images and don’t need to build anything, so all I need to deploy the app is a
docker-compose.yml file and a couple of
The docker-compose.yml file
I’m using the
wordpress:5.4.1 (also tagged as
wordpress:5.4.1-apache) which uses an Apache server and serves the app on port 80. Port 8080 is mapped to my host.
Matomo (formerly known as Piwik) is an open source web analytics application that runs on PHP and a MySQL database, which I’ve been using instead of Google Analytics.
This is the configuration I use to deploy it as described here.
I’m using the official
mariadb images and don’t need to build anything, so all I need to deploy the app is a
docker-compose.yml file and a
These are the configurations I use for a Phoenix 1.4 app to deploy it to production using docker-compose contexts. If you don’t have a server ready or
docker-compose installed on your local dev machine then have a read through that blog post first.
For this build I’m not going to dockerize NGINX as I have it installed on the server.
Create a Dockerfile
Step one is to create a
Dockerfile in the root directory of your project. For this build I’ll be using
alpine is a much slimmer Linux docker image and will reduce our overall image sizes.
In this post we’ll go over setting up a DigitalOcean Droplet to run multiple dockerized apps which we’ll deploy to production using
docker-compose and docker contexts. We’ll also set up NGINX reverse proxies for the apps we want to expose externally.
docker-compose with contexts lets us run builds and deployments to remote servers from our local dev machine. This feature is available to
docker-compose starting with release
Note: this feature is relatively easy to use, especially if you’ve used
docker-contexts before however is more suited for deploying small/hobby apps to a single server. There will be some downtime as you’re releasing new builds (generally a few seconds) so if you require zero downtime deployments, rolling updates and multiple server orchestration then you should look at docker’s swarm feature or kubernetes.