🍻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:

Example:
# 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:

Example:
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