Skip to content

Open-source status page, incident response and uptime monitoring

1.9 KB
Raw Blame
builders:
  # Stage 1: Build Go binary
  builder:
    # go-libsql links a prebuilt glibc static library through cgo, so build
    # natively on Debian for each target platform (no cross-compilation).
    fromImage: golang:1.26-bookworm
    label:
      org.opencontainers.image.stage: builder
    workdir: /go/src/app
    env:
      TZ: UTC
      CGO_ENABLED: "1"
    copy:
      # Copy source code
      - . .
    run:
      - go mod download
      # Build optimized binary
      # -trimpath: Remove file system paths from binary
      # -ldflags "-s -w": Strip debug info and symbol table
      - go build -trimpath -ldflags "-s -w" -o private-location ./cmd/server

# Runtime stage (glibc, required by go-libsql)
fromImage: debian:bookworm-slim

# Metadata labels
label:
  org.opencontainers.image.title: OpenStatus Private Location
  org.opencontainers.image.description: Private location orchestrator for OpenStatus
  org.opencontainers.image.source: https://github.com/openstatusHQ/openstatus
  org.opencontainers.image.vendor: OpenStatus
  org.opencontainers.image.authors: OpenStatus Team
workdir: /opt/bin

# Copy artifacts from builder
copy:
  - fromBuilder: builder
    source: /etc/ssl/certs/ca-certificates.crt
    target: /etc/ssl/certs/
  - fromBuilder: builder
    source: /usr/share/zoneinfo
    target: /usr/share/zoneinfo
  - fromBuilder: builder
    source: /go/src/app/private-location
    target: /opt/bin/private-location

# wget is used by the healthcheck
root:
  run:
    - apt-get update
    - apt-get install -y --no-install-recommends wget
    - rm -rf /var/lib/apt/lists/*

env:
  TZ: UTC
  USER: "1000"
  GIN_MODE: release

# Security: run as non-root user
user: "1000:1000"

# Expose port
expose: "8080"

# Health check
healthcheck:
  interval: 15s
  timeout: 10s
  start: 30s
  retries: 3
  cmd: wget -q -O /dev/null http://localhost:8080/health || exit 1

# Start application
cmd:
  - /opt/bin/private-location