3 Commits
Author SHA1 Message Date
lumither c466ba48a9 feat(Makefile) Makefile fix&cleanup 2025-11-03 13:49:56 -05:00
lumither 330dd7c2a6 feat(Makefile) add cr support 2025-11-03 13:21:13 -05:00
lumither 1966e0059c feat(action) add release build 2025-11-03 01:54:28 -05:00
6 changed files with 151 additions and 8 deletions

No files matched your search

+4
View File
@@ -17,3 +17,7 @@ WORK_DIR=/nocturne
# frontend settings # frontend settings
API_LOCAL_URL=http://backend:3001 API_LOCAL_URL=http://backend:3001
API_REMOTE_URL=https://lumither.com/api API_REMOTE_URL=https://lumither.com/api
# deployment
USE_CR=true
CHANNEL=release
+1 -1
View File
@@ -2,7 +2,7 @@ name: build canary nocturne image
on: on:
push: push:
branches: branches:
- dev - master
env: env:
REGISTRY: cr.lmt.moe REGISTRY: cr.lmt.moe
+64
View File
@@ -0,0 +1,64 @@
name: build release nocturne image
on:
push:
branches:
- release
env:
REGISTRY: cr.lmt.moe
TAG: release
PROJECT: nocturne
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup builder
uses: docker/setup-buildx-action@v3
- name: registry login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: build containers
run: |
make build
- name: tag and push
run: |
PROJECT_NAME=$(basename "$PWD")
ALL_IMAGES=$(docker compose -f prod.compose.yaml config --services 2>/dev/null)
PULLED_IMAGES=$(docker compose -f prod.compose.yaml config 2>/dev/null \
| awk '/image:/ {print $2}' \
| sort -u \
| sed 's/:.*//' \
)
TO_PUSH=$(comm -23 \
<(echo "$ALL_IMAGES" | sort) \
<(echo "$PULLED_IMAGES") \
)
FMT_STRING=$(echo "$TO_PUSH" | xargs printf '%s, ' | sed 's/, $//')
echo "services to push: $FMT_STRING"
for SERVICE in $TO_PUSH; do
LOCAL_TAG="${PROJECT_NAME}-${SERVICE}:latest"
REMOTE_TAG="${REGISTRY}/${PROJECT}/${SERVICE}:${TAG}"
if docker image inspect "$LOCAL_TAG" >/dev/null 2>&1; then
echo "Pushing $REMOTE_TAG"
docker tag "$LOCAL_TAG" "$REMOTE_TAG"
docker push "$REMOTE_TAG"
else
echo "warn: image $LOCAL_TAG not found, skipping $SERVICE"
fi
done
+27 -6
View File
@@ -3,21 +3,42 @@ ifeq ($(ARCH), arm64)
ARCH := aarch64 ARCH := aarch64
endif 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
DOCKER_ENV := ARCH=$(ARCH) TAG=$(CHANNEL)
DOCKER_COMPOSE := $(DOCKER_ENV) docker compose -f $(COMPOSE_FILE)
.PHONY: all .PHONY: all
all:up all:up
.PHONY: build .PHONY: build
build: build:
ARCH=$(ARCH) docker compose -f prod.compose.yaml build $(DOCKER_COMPOSE) pull
$(DOCKER_COMPOSE) build
.PHONY: up .PHONY: up
up: up:
ARCH=$(ARCH) docker compose -f prod.compose.yaml up -d $(DOCKER_COMPOSE) up -d
.PHONY: down .PHONY: down
down: down:
ARCH=$(ARCH) docker compose -f prod.compose.yaml down $(DOCKER_COMPOSE) down
.PHONY: rm .PHONY: clean
rm: clean:
ARCH=$(ARCH) docker compose -f prod.compose.yaml rm $(DOCKER_COMPOSE) down --rmi all --volumes
+1 -1
View File
@@ -31,6 +31,6 @@ services:
postgres: postgres:
image: postgres:16.3 image: postgres:16.3
ports: ports:
- 5432:5432 - "5432:5432"
env_file: env_file:
- ./container/dev/.env - ./container/dev/.env
+54
View File
@@ -0,0 +1,54 @@
services:
frontend:
depends_on:
- backend
image: cr.lmt.moe/nocturne/frontend:${TAG}
restart: always
ports:
- "0.0.0.0:3000:3000"
env_file:
- ./.env
backend:
depends_on:
- migrate
image: cr.lmt.moe/nocturne/backend:${TAG}
restart: always
ports:
- "0.0.0.0:3001:3001"
env_file:
- ./.env
- ./.env.local
dns:
- 1.1.1.1
migrate:
image: postgres:17
depends_on:
postgres:
condition: service_healthy
env_file:
- ./.env
- ./.env.local
volumes:
- ./migration/ddl:/migrations:ro
- ./migration/migration.sh:/migration.sh:ro
entrypoint: [ "/bin/sh", "/migration.sh" ]
postgres:
image: postgres:17
ports:
- "5432:5432"
env_file:
- ./.env
- ./.env.local
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" ]
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
restart: always