mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
* feat(v3): add server mode for headless HTTP deployment Server mode allows Wails applications to run as pure HTTP servers without native GUI dependencies. Enable with `-tags server` build tag. Features: - HTTP server with configurable host/port via ServerOptions - WAILS_SERVER_HOST and WAILS_SERVER_PORT env var overrides - WebSocket event broadcasting to connected browsers - Browser clients represented as BrowserWindow (Window interface) - Health check endpoint at /health - Graceful shutdown with configurable timeout - Docker support with Dockerfile.server template and tasks Build and run: wails3 task build:server wails3 task run:server wails3 task build:docker wails3 task run:docker Documentation at docs/guides/server-build.mdx Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(v3): add server mode for headless HTTP deployment Server mode allows Wails applications to run as pure HTTP servers without native GUI dependencies. Enable with `-tags server` build tag. Features: - HTTP server with configurable host/port via ServerOptions - WAILS_SERVER_HOST and WAILS_SERVER_PORT env var overrides - WebSocket event broadcasting to connected browsers - Browser clients represented as BrowserWindow (Window interface) - Health check endpoint at /health - Graceful shutdown with configurable timeout - Docker support with Dockerfile.server template and tasks Build and run: wails3 task build:server wails3 task run:server wails3 task build:docker wails3 task run:docker Documentation at docs/guides/server-build.mdx Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: address CodeRabbit review comments - Fix corrupted test file with embedded terminal output - Fix module name mismatch in gin-routing (was gin-example) - Fix replace directive version mismatch in gin-service - Fix placeholder module name in ios example (was changeme) - Fix Dockerfile COPY path to work from both build contexts - Fix bare URL in README (MD034 compliance) - Fix comment accuracy in getScreens (returns error, not empty slice) - Remove deprecated docker-compose version field - Add port documentation in Taskfile template Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: address CodeRabbit review comments - Add note about healthcheck wget not being available in distroless images - Add !server build constraint to menu_windows.go and menu_darwin.go - Downgrade window-visibility-test go.mod from 1.25 to 1.24 to match CI Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
80 lines
2.1 KiB
YAML
80 lines
2.1 KiB
YAML
version: '3'
|
|
|
|
vars:
|
|
APP_NAME: "server-example"
|
|
BIN_DIR: "bin"
|
|
|
|
tasks:
|
|
default:
|
|
summary: Shows available tasks
|
|
cmds:
|
|
- task --list
|
|
|
|
build:
|
|
summary: Builds the application in server mode
|
|
desc: |
|
|
Builds the application with the server build tag enabled.
|
|
Server mode runs as a pure HTTP server without native GUI dependencies.
|
|
deps:
|
|
- task: build:frontend
|
|
cmds:
|
|
- go build -tags server -o {{.BIN_DIR}}/{{.APP_NAME}} .
|
|
|
|
build:frontend:
|
|
summary: Ensures frontend assets exist (static HTML, no build needed)
|
|
dir: frontend
|
|
sources:
|
|
- dist/index.html
|
|
preconditions:
|
|
- sh: test -f dist/index.html
|
|
msg: "frontend/dist/index.html not found"
|
|
|
|
run:
|
|
summary: Builds and runs the application in server mode
|
|
deps:
|
|
- task: build
|
|
cmds:
|
|
- ./{{.BIN_DIR}}/{{.APP_NAME}}
|
|
|
|
dev:
|
|
summary: Runs the application in development mode (no build step)
|
|
desc: |
|
|
Runs the application directly with `go run` for rapid development.
|
|
Changes require restarting the command.
|
|
cmds:
|
|
- go run -tags server .
|
|
|
|
clean:
|
|
summary: Removes build artifacts
|
|
cmds:
|
|
- rm -rf {{.BIN_DIR}}
|
|
|
|
build:docker:
|
|
summary: Builds a Docker image for deployment
|
|
desc: |
|
|
Builds from v3 root to include local server mode code.
|
|
After server mode is published, can build from example dir directly.
|
|
dir: ../..
|
|
cmds:
|
|
- docker build -t {{.TAG | default "server-example:latest"}} -f examples/server/Dockerfile .
|
|
vars:
|
|
TAG: '{{.TAG}}'
|
|
preconditions:
|
|
- sh: docker info > /dev/null 2>&1
|
|
msg: "Docker is required. Please install Docker first."
|
|
|
|
run:docker:
|
|
summary: Builds and runs the Docker image
|
|
deps:
|
|
- task: build:docker
|
|
cmds:
|
|
- docker run --rm -p {{.PORT | default "8080"}}:8080 {{.TAG | default "server-example:latest"}}
|
|
vars:
|
|
TAG: '{{.TAG}}'
|
|
PORT: '{{.PORT}}'
|
|
|
|
test:
|
|
summary: Runs the server mode tests
|
|
dir: ../../pkg/application
|
|
cmds:
|
|
- go test -tags server -v -run TestServerMode .
|