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.
- Start a database service using the MySQL Docker image
- Build the Docker image for my application
- Run the newly built Docker image and connect it to the MySql database service
- Execute back-end API integration testing using Testbox
- 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.
- 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.)
- Push the image to Dockerhub using a semver tag.
- 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.
- docker/setup-buildx-action (Buildx allows for building multi-platform images)
- actions/cache (With buildx I can use Docker layer caching to speed up subsequent builds)
- docker/build-push-action (This action builds the images and optionally pushes them to a repository)
- docker/setup-qemu-action (This is needed for building images for other platforms)
- docker/login-action (Login to Dockerhub so it can push the image)
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)