DEV Community

Jason Steinshouer
Jason Steinshouer

Posted on

Building a CI/CD Workflow for my CFML/Vue.js Application

My Workflow

The goal of my project was to create a CI/CD workflow for a full-stack application written in CFML (Lucee) and Vue.js, running in Docker.

CI

Here is a simplified outline of my CI workflow.

  1. Start a database service using the MySQL Docker image
  2. Build the Docker image for my application
  3. Run the newly built Docker image and connect it to the MySql database service
  4. Execute back-end API integration testing using Testbox
  5. Execute Cypress front-end and end-to-end tests

CD

My deployment process is triggered when a Github release is created using a semver tag. Here is the general outline.

  1. Build a multi-platform Docker image. (I am utilizing the free trial of t4g.micro AWS EC2 instance so I need to run it on ARM64 architecture.)
  2. Push the image to Dockerhub using a semver tag.
  3. Connect to the server and trigger a Docker service update to pull down the new image and start it up.

Github Actions I am using

Since my application is running with Docker I am utilizing several Actions from Docker.

Submission Category:

DIY Deployments

Yaml File or Link to Code

My Movie App

Getting Started

Docker secrets

For development generate the secrets that docker-compose will use to to pass database credentails for our development environment.

mkdir secrets
openssl rand 20 | base64 -w 0 > ./secrets/MYSQL_ROOT_PASSWORD
openssl rand 20 | base64 -w 0 > ./secrets/MYSQL_PASSWORD
openssl rand 32 | base64 -w 0 | docker secret create JWT_SECRET -
echo "mydbuser" > ./secrets/MYSQL_USER

Environment variables

Create a .env file for your envrionment.

cp .env.example .env

OMDB API

This application uses the Open Movie Database API. You can register for a free API key at https://www.omdbapi.com/.

Set OMDB_API_KEY=<yourkeyhere> in the .env file.

Run the application using Docker Compose.

docker compose up

VS Code - Remote Container

You can also run the application using the VS code remote container extension.

Run the tests

Coldbox API Tests

You can execute the API tests in the terminal using this command.

docker exec -it movie-app-api
โ€ฆ

CI - main.yml

CD - release.yml

Additional Resources / Info

Here are a few of the resources I used for setting up my workflows.

Top comments (0)