You Can Automate DevOps Yourself Using GitLab CI And Docker-Compose

Sean Bradley
5 min readMar 31, 2019
Overview of the Finished GitLab CI Process

You are here because you want to set up an auto deployment pipeline for your amazing full stack project.

In this article I will show you how to do this yourself.

The project I will use is a prebuilt NodeJS API, which when run, is exposed behind a Nginx proxy, and containerised using docker-compose. The project exists in GitHub under several branches Dev, UAT, Staging and Production. You can create and manage your branches any way you wish.

The NodeJS API Application as seen from .gitLab-ci.yml

The code is hosted at

The finished process will be,

  1. You commit and push your changes to a GitHub branch
  2. GitLab CI will detect the latest changes on GitHub and mirror the changes to your GitLab repository.
  3. GitLab CI will then trigger the GitLab Runner to start the pipeline for the particular branch, which will pull the latest code, build and run the docker-compose process.
  4. If no errors occurred during build and deployment, your latest commit will now be live.

The NodeJS API process is started within a docker-compose process and exposed behind another Nginx proxy process, with a static folder where you can place static CSS, JavaScript and HTML. The Nginx proxy forwards all /api/ calls to the NodeJS API, and everything else to the static folder. So you can choose the front end framework of your choice.

Docker-compose is a great tool in this setup since the internal application, your chosen components and internal architecture are treated agnostically by GitLab runner. You internal application does not have to be NodeJS and Nginx in order for docker-compose and GitLab CI to work together to create a CI/CD workflow for your application. This method works equally well for Python, Java, C#, Angular, React, MongoDB, MySQL, Redis or whatever…

Sean Bradley

Developer of real time, low latency, high availability, asynchronous, multi threaded, remotely managed, fully automated and monitored solutions.