Add Docker support with Dockerfile, entrypoint script, and CI workflows
- Introduced a Dockerfile for building the application with Go and Node.js dependencies. - Added a docker-entrypoint.sh script to manage container execution. - Created a .dockerignore file to exclude unnecessary files from the Docker context. - Updated Makefile to include a new target for building the Docker image. - Added CI workflows for testing, formatting, and releasing artifacts in Gitea.
This commit is contained in:
@@ -3,8 +3,9 @@ CMD_DIR := ./cmd/scratchbox
|
||||
BIN_DIR := ./bin
|
||||
BIN := $(BIN_DIR)/$(APP_NAME)
|
||||
CONFIG ?= config.yaml
|
||||
DOCKER_IMAGE ?= scratchbox:dev
|
||||
|
||||
.PHONY: help run dev config build test test-race fmt clean
|
||||
.PHONY: help run dev config build docker test test-race fmt clean
|
||||
|
||||
help:
|
||||
@echo "Targets:"
|
||||
@@ -12,6 +13,7 @@ help:
|
||||
@echo " make dev - Build and run server (CONFIG=$(CONFIG))"
|
||||
@echo " make config - Write default config to $(CONFIG) and generate sibling config.key if missing"
|
||||
@echo " make build - Build Svelte UI and binary to $(BIN)"
|
||||
@echo " make docker - Build Docker image (DOCKER_IMAGE=$(DOCKER_IMAGE))"
|
||||
@echo " make test - Run all Go tests with timeout and shuffle"
|
||||
@echo " make test-race - Run all Go tests with race detector and timeout"
|
||||
@echo " make fmt - Format Go code"
|
||||
@@ -32,7 +34,10 @@ config:
|
||||
build: clean
|
||||
npm --prefix ./web/ui run build
|
||||
mkdir -p $(BIN_DIR)
|
||||
go build -o $(BIN) $(CMD_DIR)
|
||||
CGO_ENABLED=0 go build -o $(BIN) $(CMD_DIR)
|
||||
|
||||
docker:
|
||||
docker build -t $(DOCKER_IMAGE) .
|
||||
|
||||
test:
|
||||
go test -timeout 30s -shuffle=on ./...
|
||||
|
||||
Reference in New Issue
Block a user