🍻Makefile and Docker-Compose
A place for simple, repeatable CI/CD patterns, examples and code-snippets for a solid Developer experience. Here you'll find examples of using Makefiles for CI/CD.

Make for task running and dependency management:
Make for task running and dependency management:Manages reusable, consistent task running for CI/CD with minimal dependency
Can run prerequisite tasks / commands for dependency chaining
Allows flexibility to run tasks that don't require containerization (eg: for a linux only environment, running a
curltask natively doesn't require a docker container)Native to Unix based Operating Systems and WSL2. 3mb executable on Windows
Small learning curve with widely available standards and patterns
A mature and industry-wide used tool with a large online community
Entirely Opensource
# Variables
s3_bucket = "my-frontend-website"
# Install npm dependencies and start container on port "http://localhost:3001"
start:
docker-compose up -d --build node
echo "Navigate to http://localhost:3001"
# Build application for deployment
build:
docker-compose run --rm --entrypoint "npm run build" node
# First run the dependent "build" task then deploy build folder to AWS S3 using awscli
deploy: build
aws s3 sync build/ s3://$(s3_bucket) --acl public-read"
echo "Upload complete."
Docker-Compose for container management:
Docker-Compose for container management:A mature and Industry wide used tool with a large online community
YAML based configuration with small learning curve
Decoupled from task running and dependency management
On it's own
docker-composehas limitations which are mitigated bymakewhich takes care of container based task running and task dependencies
version: '3.7'
services:
node:
container_name: node
build:
context: .
dockerfile: Dockerfile
volumes:
- '.:/app'
- '/app/node_modules'
ports:
- 3001:3000
environment:
- CHOKIDAR_USEPOLLING=true
👇 Strongly influenced by the "3 musketeers" pattern and put into practice at enterprise scale
Last updated