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>
55 lines
1.5 KiB
Docker
55 lines
1.5 KiB
Docker
# Wails Server Mode Dockerfile
|
|
# Multi-stage build for minimal image size
|
|
#
|
|
# BUILD FROM v3 ROOT (to use local code before server mode is published):
|
|
# docker build -t server-example -f examples/server/Dockerfile .
|
|
#
|
|
# BUILD FROM EXAMPLE DIR (after server mode is published):
|
|
# cd examples/server && docker build -t server-example .
|
|
|
|
# Build stage
|
|
FROM golang:alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache git
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# If building from example dir, remove replace directive
|
|
# If building from v3 root, this is a no-op
|
|
RUN sed -i '/^replace/d' go.mod 2>/dev/null || true
|
|
|
|
# Download dependencies
|
|
RUN go mod tidy
|
|
|
|
# Build the server binary and prepare assets
|
|
# When building from v3 root, change to example dir
|
|
RUN if [ -d "examples/server" ]; then \
|
|
cd examples/server && go build -tags server -ldflags="-s -w" -o /app/server . && \
|
|
cp -r frontend/dist /app/frontend_dist; \
|
|
else \
|
|
go build -tags server -ldflags="-s -w" -o /app/server . && \
|
|
cp -r frontend/dist /app/frontend_dist; \
|
|
fi
|
|
|
|
# Runtime stage - minimal image
|
|
FROM gcr.io/distroless/static-debian12
|
|
|
|
# Copy the binary
|
|
COPY --from=builder /app/server /server
|
|
|
|
# Copy frontend assets
|
|
COPY --from=builder /app/frontend_dist /frontend/dist
|
|
|
|
# Expose the default port
|
|
EXPOSE 8080
|
|
|
|
# Bind to all interfaces (required for Docker)
|
|
# Can be overridden at runtime with -e WAILS_SERVER_HOST=...
|
|
ENV WAILS_SERVER_HOST=0.0.0.0
|
|
|
|
# Run the server
|
|
ENTRYPOINT ["/server"]
|