Skip to content

Commit 3885841

Browse files
committed
added mechanism to build release
1 parent d8adbd9 commit 3885841

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ webapp/*.tsbuildinfo
3737
webapp/next-env.d.ts
3838

3939
backend/out
40-
backend/bin
40+
backend/bin
41+
backend/release

Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PKG_MANAGER ?= pnpm
55
# CAUTION: The server port is also used in the frontend ajaxPromise.ts file, make sure to change it there as well if you change it here and rebuild the frontend. This should be a smooth process in the future.
66
SERVER_PORT ?= 8080
77
EMU_PORT ?= 8081
8-
PROJECT_ID ?= project-id
8+
PROJECT_ID ?= exactbuyer-api-staging
99

1010
# Paths
1111
BACKEND_PATH := backend
@@ -68,7 +68,7 @@ run-frontend:
6868

6969
build-backend:
7070
@echo "Building the backend application..."
71-
cd $(BACKEND_PATH) && go build -o bin/service .
71+
cd $(BACKEND_PATH) && export GIN_MODE=release && go build -o bin/service .
7272

7373
build-frontend:
7474
@echo "Building the frontend application..."
@@ -84,3 +84,20 @@ clean-run:
8484
@cp -r $(FRONTEND_PATH)/out $(BACKEND_PATH)/
8585

8686
setup: setup-backend setup-frontend check-and-copy-out
87+
88+
clean:
89+
@echo "Cleaning up previous builds..."
90+
@rm -rf $(BACKEND_PATH)/release
91+
@rm -f $(BACKEND_PATH)/release.zip
92+
93+
build-release: clean build-frontend
94+
build-release:
95+
@echo "Building Release"
96+
@echo "Building the backend application..."
97+
@mkdir -p $(BACKEND_PATH)/release
98+
@cd $(BACKEND_PATH) && export GIN_MODE=release && go build -o release/service .
99+
@echo "Copying out directory from frontend to release..."
100+
@cp -r $(FRONTEND_PATH)/out $(BACKEND_PATH)/release
101+
@echo "Creating release archive..."
102+
@cd $(BACKEND_PATH) && zip -r release.zip release
103+
@echo "Release build complete. Archive created at $(BACKEND_PATH)/release.zip"

backend/main.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,6 @@ func usage() {
8585
}
8686

8787
func main() {
88-
89-
files, err := content.ReadDir("out")
90-
if err != nil {
91-
fmt.Println("Error reading embedded directory:", err)
92-
} else {
93-
fmt.Println("Files in embedded directory:")
94-
for _, file := range files {
95-
fmt.Println(" - ", file.Name())
96-
}
97-
}
9888
port := flag.String("port", "8080", "Port for the emulator")
9989
projectId := flag.String("project", "my-project", "Project ID for the emulator")
10090
emulatorHost := flag.String("emuHost", "localhost:8081", "Host for the emulator")

0 commit comments

Comments
 (0)