From 35b82fc5b3a6420d14c41f70dec9d544b9fb066c Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sat, 11 Jul 2026 21:43:55 +0200 Subject: [PATCH] chore: add dev/deploy targets to Makefile, deploy.sh --- Makefile | 18 +++++++++++++++++- deploy.sh | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 deploy.sh diff --git a/Makefile b/Makefile index 6ff5573..9458591 100644 --- a/Makefile +++ b/Makefile @@ -25,4 +25,20 @@ fix: cargo fmt cargo clippy --fix --allow-dirty --allow-staged -.PHONY: check fmt fmt-check clippy test fix publish +# Build the frontend SPA. +build-app: + cd app && npm run build + +# Run the backend (builds frontend first if needed). +dev: build-app + JWT_SECRET=dev-secret ALLOW_REGISTRATION=true cargo run -p presentation + +# Run backend only (skip frontend build, assumes build-app was run). +dev-api: + JWT_SECRET=dev-secret ALLOW_REGISTRATION=true cargo run -p presentation + +# Build and push Docker image to private registry. +deploy: + ./deploy.sh + +.PHONY: check fmt fmt-check clippy test fix build-app dev dev-api deploy diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..5815440 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euo pipefail + +REGISTRY="registry.gabrielkaszewski.dev" +REPO="pocket-chords" + +tag="latest" + +while [[ $# -gt 0 ]]; do + case $1 in + --tag) tag="$2"; shift 2 ;; + *) echo "usage: $0 [--tag T]" >&2; exit 1 ;; + esac +done + +image="${REGISTRY}/${REPO}:${tag}" + +echo "building ${image}" +docker buildx build --platform linux/amd64 \ + -t "$image" --push . +echo "pushed $image"