From cea27492522c3e9eb414bb776e050378f27cf93d Mon Sep 17 00:00:00 2001 From: Jp Date: Thu, 26 Feb 2026 11:34:48 +0800 Subject: [PATCH] ci: build image remotely before deploying to server Previously the image was built locally and pushed to a registry. Now we build directly on the remote server to simplify the deployment flow and avoid registry dependencies. --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b068ecc..0717208 100644 --- a/Makefile +++ b/Makefile @@ -21,11 +21,13 @@ deploy: build deploy-server: @echo "Deploying to remote server $(SERVER_IP)..." - @# Generate temporary merged YAML for server in /tmp to avoid WSL permissions + @# Build image on the remote server + ssh $(SERVER_USER)@$(SERVER_IP) "cd $(SERVER_PATH) && sudo podman build -t $(IMG) ." + @# Generate temporary merged YAML for server in /tmp @sudo kubectl create configmap mkm-admin-config --from-env-file=.env --dry-run=client -o yaml > /tmp/server_deploy.yaml @echo "---" >> /tmp/server_deploy.yaml @cat k8s/deployment.yaml >> /tmp/server_deploy.yaml - @# Single SCP/SSH call to reduce password prompts + @# Single SCP/SSH call to apply scp /tmp/server_deploy.yaml $(SERVER_USER)@$(SERVER_IP):/tmp/server_deploy.yaml ssh $(SERVER_USER)@$(SERVER_IP) "sudo kubectl apply -f /tmp/server_deploy.yaml && rm -f /tmp/server_deploy.yaml" @rm -f /tmp/server_deploy.yaml