feat: add Makefile and docker-compose production overlay
This commit is contained in:
34
Makefile
34
Makefile
@@ -1,5 +1,33 @@
|
|||||||
run: stop
|
# === Configuration ===
|
||||||
docker compose up -d
|
# Default value is 'dev'. Can be overridden with 'make ENV=prod ...'
|
||||||
|
ENV ?= dev
|
||||||
|
COMPOSE_FILE = docker-compose$(if $(filter $(ENV),prod),.prod,).yml
|
||||||
|
COMPOSE = docker compose -f $(COMPOSE_FILE)
|
||||||
|
|
||||||
|
.PHONY: up stop build deploy logs
|
||||||
|
|
||||||
|
# Standard Start (on iMac: 'make run' -> dev | on Pi: 'make ENV=prod run')
|
||||||
|
run: stop up
|
||||||
|
|
||||||
|
up:
|
||||||
|
$(COMPOSE) up -d
|
||||||
|
|
||||||
|
# Build command
|
||||||
|
build:
|
||||||
|
$(COMPOSE) build
|
||||||
|
|
||||||
|
# The Deployment Routine for your Pi
|
||||||
|
# You would call this with: make ENV=prod deploy
|
||||||
|
deploy: stop pull build up clean
|
||||||
|
|
||||||
|
pull:
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
stop:
|
stop:
|
||||||
docker compose down --remove-orphans
|
$(COMPOSE) down --remove-orphans
|
||||||
|
|
||||||
|
logs:
|
||||||
|
$(COMPOSE) logs -f
|
||||||
|
|
||||||
|
clean:
|
||||||
|
docker image prune -f
|
||||||
9
docker-compose.prod.yml
Normal file
9
docker-compose.prod.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
image: cgr-next-js-prod
|
||||||
|
volumes: !reset []
|
||||||
|
command: !reset []
|
||||||
|
ports:
|
||||||
|
- "80:3000"
|
||||||
|
restart: always
|
||||||
Reference in New Issue
Block a user