Skip to content

Commit 5af056c

Browse files
committed
feat: add local build target for standalone binaries and update .gitignore
1 parent f8e5394 commit 5af056c

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
# vendor/
1717

1818
docker-volumes
19+
tmp/
20+
dist/
21+
image/app/frontend/dist/datasync/
1922
*.tar.gz
2023
*.war
2124
image/coverage.html

Makefile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,61 @@ build: fmt ## Build Docker image
3232
--build-arg BASE_HREF=$(BUILD_BASE_HREF) --build-arg CUSTOMIZATIONS=$(CUSTOMIZATIONS) \
3333
--tag "$(IMAGE_TAG)" --file image/Dockerfile .
3434

35+
build-local: fmt ## Build standalone binaries with local filesystem plugin for all platforms
36+
@echo "=== Building standalone integration binaries ==="
37+
@# Create temp build directory
38+
rm -rf ./tmp/build-local
39+
mkdir -p ./tmp/build-local
40+
@echo "Using temp directory: ./tmp/build-local"
41+
@# Download and extract frontend (like Dockerfile does)
42+
@echo "Downloading frontend (version $(FRONTEND_VERSION))..."
43+
curl -sL https://github.com/libis/rdm-integration-frontend/archive/refs/tags/$(FRONTEND_VERSION).tar.gz -o ./tmp/build-local/$(FRONTEND_VERSION).tar.gz
44+
cd ./tmp/build-local && tar -xzf $(FRONTEND_VERSION).tar.gz
45+
@# Install and build frontend
46+
@echo "Installing frontend dependencies..."
47+
cd ./tmp/build-local/rdm-integration-frontend-$(FRONTEND_VERSION) && NODE_ENV=development npm ci --no-audit --progress=false
48+
@echo "Building frontend..."
49+
cd ./tmp/build-local/rdm-integration-frontend-$(FRONTEND_VERSION) && npm run build -- --configuration=$(NODE_ENV) --base-href=/
50+
@# Copy frontend dist to image (note: Dockerfile uses dist/datasync/browser)
51+
mkdir -p image/app/frontend/dist
52+
rm -rf image/app/frontend/dist/datasync
53+
cp -r ./tmp/build-local/rdm-integration-frontend-$(FRONTEND_VERSION)/dist/datasync/browser image/app/frontend/dist/datasync
54+
@# Apply customizations (like Dockerfile does)
55+
cp -r ./conf/customizations/* image/app/frontend/dist/datasync/
56+
@# Build binaries for all platforms
57+
@echo "Building binaries..."
58+
mkdir -p dist
59+
@# Demo Dataverse binaries
60+
@echo " -> demo-integration-local (Linux amd64)"
61+
cd image && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.DataverseServer=https://demo.dataverse.org -X 'main.DataverseServerName=Demo Dataverse'" -o ../dist/demo-integration-local-linux-amd64 ./app/local
62+
@echo " -> demo-integration-local (Linux arm64)"
63+
cd image && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X main.DataverseServer=https://demo.dataverse.org -X 'main.DataverseServerName=Demo Dataverse'" -o ../dist/demo-integration-local-linux-arm64 ./app/local
64+
@echo " -> demo-integration-local (macOS amd64)"
65+
cd image && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X main.DataverseServer=https://demo.dataverse.org -X 'main.DataverseServerName=Demo Dataverse'" -o ../dist/demo-integration-local-darwin-amd64 ./app/local
66+
@echo " -> demo-integration-local (macOS arm64)"
67+
cd image && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X main.DataverseServer=https://demo.dataverse.org -X 'main.DataverseServerName=Demo Dataverse'" -o ../dist/demo-integration-local-darwin-arm64 ./app/local
68+
@echo " -> demo-integration-local (Windows amd64)"
69+
cd image && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.DataverseServer=https://demo.dataverse.org -X 'main.DataverseServerName=Demo Dataverse'" -o ../dist/demo-integration-local-windows-amd64.exe ./app/local
70+
@# Harvard Dataverse binaries
71+
@echo " -> harvard-integration-local (Linux amd64)"
72+
cd image && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.DataverseServer=https://dataverse.harvard.edu -X 'main.DataverseServerName=Harvard Dataverse'" -o ../dist/harvard-integration-local-linux-amd64 ./app/local
73+
@echo " -> harvard-integration-local (Linux arm64)"
74+
cd image && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X main.DataverseServer=https://dataverse.harvard.edu -X 'main.DataverseServerName=Harvard Dataverse'" -o ../dist/harvard-integration-local-linux-arm64 ./app/local
75+
@echo " -> harvard-integration-local (macOS amd64)"
76+
cd image && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X main.DataverseServer=https://dataverse.harvard.edu -X 'main.DataverseServerName=Harvard Dataverse'" -o ../dist/harvard-integration-local-darwin-amd64 ./app/local
77+
@echo " -> harvard-integration-local (macOS arm64)"
78+
cd image && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X main.DataverseServer=https://dataverse.harvard.edu -X 'main.DataverseServerName=Harvard Dataverse'" -o ../dist/harvard-integration-local-darwin-arm64 ./app/local
79+
@echo " -> harvard-integration-local (Windows amd64)"
80+
cd image && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.DataverseServer=https://dataverse.harvard.edu -X 'main.DataverseServerName=Harvard Dataverse'" -o ../dist/harvard-integration-local-windows-amd64.exe ./app/local
81+
@# Cleanup: restore placeholder index.html and remove temp directory
82+
rm -rf image/app/frontend/dist/datasync
83+
mkdir -p image/app/frontend/dist/datasync
84+
echo "This file will be replaced during the build." > image/app/frontend/dist/datasync/index.html
85+
rm -rf ./tmp/build-local
86+
@echo ""
87+
@echo "=== Build complete! Binaries available in dist/ ==="
88+
@ls -lh dist/
89+
3590
push: ## Push Docker image (only in prod stage)
3691
if [ "$(STAGE)" = "prod" ]; then \
3792
echo "Pushing Docker image to repository ..."; \
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
This file will be replaced during the build.
1+
This file will be replaced during the build.

0 commit comments

Comments
 (0)