🧬React/Node - AWS S3
.SILENT:
.PHONY: start build deploy clean
# Environment variables
S3_BUCKET =
# 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
# Deploy build folder to AWS S3
deploy:
docker-compose run --rm --entrypoint "aws s3 sync build/ s3://$(S3_BUCKET) --acl public-read" awscli
echo "Upload complete."
# Docker clean-up
clean:
echo "Purging orphaned Docker networks..."
docker-compose down --remove-orphans 2>/dev/null
docker system prune -afLast updated