| # Multi-stage Docker build for Air Mouse Pro Server | |
| # Stage 1: Build | |
| FROM golang:1.23-alpine AS builder | |
| # Install build dependencies | |
| RUN apk add --no-cache git make gcc musl-dev linux-headers | |
| # Set working directory | |
| WORKDIR /build | |
| # Copy go mod files | |
| COPY go.mod go.sum ./ | |
| RUN go mod download | |
| # Copy source code | |
| COPY . . | |
| # Build arguments | |
| ARG VERSION=3.0.0 | |
| ARG BUILD_TIME | |
| ARG GIT_COMMIT | |
| # Build the binary | |
| RUN CGO_ENABLED=1 GOOS=linux go build \ | |
| -ldflags "-X main.version=${VERSION} -X main.buildTime=${BUILD_TIME} -X main.gitCommit=${GIT_COMMIT}" \ | |
| -o airmouse-server ./cmd/airmouse-server | |
| # Stage 2: Runtime | |
| FROM alpine:3.19 | |
| # Install runtime dependencies | |
| RUN apk add --no-cache \ | |
| ca-certificates \ | |
| libx11 \ | |
| libxrandr \ | |
| libxinerama \ | |
| libxcursor \ | |
| libxi \ | |
| mesa-gl \ | |
| bluetooth \ | |
| bluez \ | |
| bluez-utils \ | |
| dbus \ | |
| udev \ | |
| curl | |
| # Create necessary directories | |
| RUN mkdir -p /app /etc/airmouse /var/lib/airmouse /var/log/airmouse | |
| # Copy binary from builder | |
| COPY --from=builder /build/airmouse-server /app/ | |
| # Copy configuration example | |
| COPY config.example.json /etc/airmouse/config.example.json | |
| # Copy web assets | |
| COPY web/static /app/web/static | |
| # Set working directory | |
| WORKDIR /app | |
| # Expose ports | |
| EXPOSE 8080 8081 8082/udp | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ | |
| CMD curl -f http://localhost:8081/health || exit 1 | |
| # Environment variables | |
| ENV CONFIG_PATH=/etc/airmouse/config.json \ | |
| LOG_LEVEL=info \ | |
| LOG_FILE=/var/log/airmouse/airmouse.log | |
| # Volume mounts | |
| VOLUME ["/etc/airmouse", "/var/lib/airmouse", "/var/log/airmouse"] | |
| # Run the application | |
| ENTRYPOINT ["/app/airmouse-server"] |
Xet Storage Details
- Size:
- 1.71 kB
- Xet hash:
- f74b4e45589d9b26fafc0bd2805ca9815b9354e21a73c2ff3679991050c0dca1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.