From 330dd7c2a6c4091b821ebef5110195e485f5426d Mon Sep 17 00:00:00 2001 From: Lumither Tao Date: Mon, 3 Nov 2025 13:21:13 -0500 Subject: [PATCH] feat(Makefile) add cr support --- .env | 6 +++++- Makefile | 31 +++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.env b/.env index 3007617..dfc4bd4 100644 --- a/.env +++ b/.env @@ -16,4 +16,8 @@ WORK_DIR=/nocturne # frontend settings API_LOCAL_URL=http://backend:3001 -API_REMOTE_URL=https://lumither.com/api \ No newline at end of file +API_REMOTE_URL=https://lumither.com/api + +# deployment +USE_CR=true +CHANNEL=release \ No newline at end of file diff --git a/Makefile b/Makefile index bfdd1e5..733a642 100644 --- a/Makefile +++ b/Makefile @@ -3,21 +3,40 @@ ifeq ($(ARCH), arm64) ARCH := aarch64 endif +ifneq (,$(wildcard ./.env)) + include ./.env + export +endif +ifneq (,$(wildcard ./.env.local)) + include ./.env.local + export +endif + +USE_CR ?= false +CHANNEL ?= release +ifeq ($(USE_CR), true) + COMPOSE_FILE := prod.cr.compose.yaml +else + COMPOSE_FILE := prod.compose.yaml +endif + + .PHONY: all all:up .PHONY: build build: - ARCH=$(ARCH) docker compose -f prod.compose.yaml build + ARCH=$(ARCH) TAG=$(CHANNEL) docker compose -f $(COMPOSE_FILE) pull + ARCH=$(ARCH) TAG=$(CHANNEL) docker compose -f $(COMPOSE_FILE) build .PHONY: up up: - ARCH=$(ARCH) docker compose -f prod.compose.yaml up -d + ARCH=$(ARCH) docker compose -f $(COMPOSE_FILE) up -d .PHONY: down down: - ARCH=$(ARCH) docker compose -f prod.compose.yaml down + ARCH=$(ARCH) docker compose -f $(COMPOSE_FILE) down -.PHONY: rm -rm: - ARCH=$(ARCH) docker compose -f prod.compose.yaml rm +.PHONY: clean +clean: + ARCH=$(ARCH) docker compose -f $(COMPOSE_FILE) down --rmi all --volumes \ No newline at end of file