From 9a9d5b3cec477016f49f87478b66e8a3ccf952eb Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Tue, 11 Jun 2024 13:10:42 +0700 Subject: [PATCH] Makefile: build now uses upx and CGO_ENABLED=0 --- .gitignore | 2 ++ Makefile | 7 ++++++- flake.nix | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 73e99bb..27b9f76 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,5 @@ public/*.min.js models/ /out + +/redmage diff --git a/Makefile b/Makefile index 4a1de4d..5e961d9 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ export REDMAGE_WEB_DEPENDENCIES_DAYJS_VERSION=$(shell echo "$${REDMAGE_WEB_DEPEN export REDMAGE_WEB_DEPENDENCIES_ALPINEJS_VERSION=$(shell echo "$${REDMAGE_WEB_DEPENDENCIES_ALPINEJS_VERSION:-3.13.10}") export REDMAGE_RUNTIME_VERSION=$(shell echo "$${REDMAGE_RUNTIME_VERSION:-unknown}") +export GCO_ENABLED=0 + start: dev-dependencies web-dependencies migrate-up REDMAGE_RUNTIME_VERSION=$(shell git describe --tags --abbrev=0) air @@ -84,7 +86,10 @@ web-build-docker: npx tailwindcss --minify -i views/style.css -o public/style.css build: web-dependencies build-dependencies prepare - go build -o redmage + go build -ldflags="-s -w" -o redmage + +build-prod: build + upx -9 redmage build-docker: goose up diff --git a/flake.nix b/flake.nix index 453afef..2ea66f3 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,7 @@ nodePackages_latest.nodejs goose air + upx ]; }; };