Skip to content

Open-source status page, incident response and uptime monitoring

4.7 KB
Raw Blame
effective: |
  builders:
    builder:
      fromImage:
        path: golang
        digest: sha256:dc9ad6c05acc7a88e5b71bde60a5fe3bd4b9f0db209011711b464107438a8107
      label:
        org.opencontainers.image.base.name: docker.io/golang:1.26-bookworm
        org.opencontainers.image.stage: builder
        org.opencontainers.image.base.digest: sha256:dc9ad6c05acc7a88e5b71bde60a5fe3bd4b9f0db209011711b464107438a8107
      workdir: /go/src/app
      env:
        TZ: UTC
        CGO_ENABLED: '1'
      copy:
      - paths:
        - .
        target: .
      run:
      - go mod download
      - go build -trimpath -ldflags "-s -w" -o private-location ./cmd/server
  fromImage:
    path: debian
    digest: sha256:7c7b2c966bc9ee8cedfeef67e0e279108992c77681fa595db4a9d65c06ccc587
  label:
    org.opencontainers.image.description: Private location orchestrator for OpenStatus
    org.opencontainers.image.authors: OpenStatus Team
    io.dofigen.version: 2.8.0
    org.opencontainers.image.base.name: docker.io/debian:bookworm-slim
    org.opencontainers.image.vendor: OpenStatus
    org.opencontainers.image.title: OpenStatus Private Location
    org.opencontainers.image.source: https://github.com/openstatusHQ/openstatus
    org.opencontainers.image.base.digest: sha256:7c7b2c966bc9ee8cedfeef67e0e279108992c77681fa595db4a9d65c06ccc587
  user:
    user: '1000'
    group: '1000'
  workdir: /opt/bin
  env:
    TZ: UTC
    USER: '1000'
    GIN_MODE: release
  copy:
  - fromBuilder: builder
    paths:
    - /etc/ssl/certs/ca-certificates.crt
    target: /etc/ssl/certs/
  - fromBuilder: builder
    paths:
    - /usr/share/zoneinfo
    target: /usr/share/zoneinfo
  - fromBuilder: builder
    paths:
    - /go/src/app/private-location
    target: /opt/bin/private-location
  root:
    run:
    - apt-get update
    - apt-get install -y --no-install-recommends wget
    - rm -rf /var/lib/apt/lists/*
  cmd:
  - /opt/bin/private-location
  expose:
  - port: 8080
  healthcheck:
    cmd: wget -q -O /dev/null http://localhost:8080/health || exit 1
    interval: 15s
    timeout: 10s
    start: 30s
    retries: 3
images:
  docker.io:
    library:
      golang:
        1.26-bookworm:
          digest: sha256:dc9ad6c05acc7a88e5b71bde60a5fe3bd4b9f0db209011711b464107438a8107
      debian:
        bookworm-slim:
          digest: sha256:7c7b2c966bc9ee8cedfeef67e0e279108992c77681fa595db4a9d65c06ccc587
resources:
  dofigen.yml:
    hash: d04fca5247e646329f8612305da818b8d5ae47f9bae8c811690e0a61dd819b5d
    content: |
      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