dnote/Makefile
Sung 7d44c541a4
Add Docker images for linux arm64, armv7, 386 (#697)
* Add multi-platform Docker support for ARM64, ARMv7, and 386

* Support freebsd amd64 for server

* Build docker images locally
2025-10-19 14:30:55 -07:00

97 lines
2.2 KiB
Makefile

NPM := $(shell command -v npm 2> /dev/null)
GH := $(shell command -v gh 2> /dev/null)
currentDir = $(shell pwd)
serverOutputDir = ${currentDir}/build/server
cliOutputDir = ${currentDir}/build/cli
cliHomebrewDir = ${currentDir}/../homebrew-dnote
## installation
install: install-go install-js
.PHONY: install
install-go:
@echo "==> installing go dependencies"
@go mod download
.PHONY: install-go
install-js:
ifndef NPM
$(error npm is not installed)
endif
@echo "==> installing js dependencies"
ifeq ($(CI), true)
@(cd ${currentDir}/pkg/server/assets && npm ci --cache $(NPM_CACHE_DIR) --prefer-offline --unsafe-perm=true)
else
@(cd ${currentDir}/pkg/server/assets && npm install)
endif
.PHONY: install-js
## test
test: test-cli test-api test-e2e
.PHONY: test
test-cli:
@echo "==> running CLI test"
@(${currentDir}/scripts/cli/test.sh)
.PHONY: test-cli
test-api:
@echo "==> running API test"
@(${currentDir}/scripts/server/test-local.sh)
.PHONY: test-api
test-e2e:
@echo "==> running E2E test"
@(${currentDir}/scripts/e2e/test.sh)
.PHONY: test-e2e
# development
dev-server:
@echo "==> running dev environment"
@VERSION=master ${currentDir}/scripts/server/dev.sh
.PHONY: dev-server
build-server:
ifndef version
$(error version is required. Usage: make version=0.1.0 build-server)
endif
@echo "==> building server assets"
@(cd "${currentDir}/pkg/server/assets/" && ./styles/build.sh)
@(cd "${currentDir}/pkg/server/assets/" && ./js/build.sh)
@echo "==> building server"
@${currentDir}/scripts/server/build.sh $(version)
.PHONY: build-server
build-server-docker: build-server
ifndef version
$(error version is required. Usage: make version=0.1.0 [platform=linux/amd64] build-server-docker)
endif
@echo "==> building Docker image"
@(cd ${currentDir}/host/docker && ./build.sh $(version) $(platform))
.PHONY: build-server-docker
build-cli:
ifeq ($(debug), true)
@echo "==> building cli in dev mode"
@${currentDir}/scripts/cli/dev.sh
else
ifndef version
$(error version is required. Usage: make version=0.1.0 build-cli)
endif
@echo "==> building cli"
@${currentDir}/scripts/cli/build.sh $(version)
endif
.PHONY: build-cli
clean:
@git clean -f
@rm -rf build
.PHONY: clean