Openstatus www.openstatus.dev
at main 153 lines 4.7 kB view raw
1effective: | 2 builders: 3 builder: 4 fromImage: 5 path: golang 6 digest: sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb 7 label: 8 org.opencontainers.image.base.name: docker.io/golang:1.25-alpine 9 org.opencontainers.image.stage: builder 10 org.opencontainers.image.base.digest: sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb 11 workdir: /go/src/app 12 arg: 13 TARGETOS: '' 14 TARGETARCH: '' 15 env: 16 CGO_ENABLED: '0' 17 TZ: UTC 18 copy: 19 - paths: 20 - . 21 target: . 22 run: 23 - apk add --no-cache tzdata 24 - go mod download 25 - GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -ldflags "-s -w" -o private-location ./cmd/server 26 fromImage: 27 path: alpine 28 digest: sha256:5405e8f36ce1878720f71217d664aa3dea32e5e5df11acbf07fc78ef5661465b 29 label: 30 org.opencontainers.image.description: Private location orchestrator for OpenStatus 31 org.opencontainers.image.source: https://github.com/openstatusHQ/openstatus 32 org.opencontainers.image.title: OpenStatus Private Location 33 org.opencontainers.image.vendor: OpenStatus 34 org.opencontainers.image.base.digest: sha256:5405e8f36ce1878720f71217d664aa3dea32e5e5df11acbf07fc78ef5661465b 35 io.dofigen.version: 2.5.1 36 org.opencontainers.image.authors: OpenStatus Team 37 org.opencontainers.image.base.name: docker.io/alpine:3.21 38 user: 39 user: '1000' 40 group: '1000' 41 workdir: /opt/bin 42 env: 43 GIN_MODE: release 44 TZ: UTC 45 USER: '1000' 46 copy: 47 - fromBuilder: builder 48 paths: 49 - /etc/ssl/certs/ca-certificates.crt 50 target: /etc/ssl/certs/ 51 - fromBuilder: builder 52 paths: 53 - /usr/share/zoneinfo 54 target: /usr/share/zoneinfo 55 - fromBuilder: builder 56 paths: 57 - /go/src/app/private-location 58 target: /opt/bin/private-location 59 cmd: 60 - /opt/bin/private-location 61 expose: 62 - port: 8080 63 healthcheck: 64 cmd: wget --spider -q http://localhost:8080/health || exit 1 65 interval: 15s 66 timeout: 10s 67 start: 30s 68 retries: 3 69images: 70 docker.io: 71 library: 72 golang: 73 1.25-alpine: 74 digest: sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb 75 alpine: 76 '3.21': 77 digest: sha256:5405e8f36ce1878720f71217d664aa3dea32e5e5df11acbf07fc78ef5661465b 78resources: 79 dofigen.yml: 80 hash: 515b6b2ef60b8f0ea954fce96aed5dc7aadf75ceefa6c9ea56f514ac14e7422b 81 content: | 82 builders: 83 # Stage 1: Build Go binary 84 builder: 85 fromImage: golang:1.25-alpine 86 platform: $BUILDPLATFORM 87 label: 88 org.opencontainers.image.stage: builder 89 workdir: /go/src/app 90 # Build-time arguments (overwritten by .env.docker at runtime) 91 args: 92 TARGETOS: "" 93 TARGETARCH: "" 94 env: 95 TZ: UTC 96 CGO_ENABLED: "0" 97 copy: 98 # Copy source code 99 - . . 100 run: 101 - apk add --no-cache tzdata 102 - go mod download 103 # Build optimized binary 104 # -trimpath: Remove file system paths from binary 105 # -ldflags "-s -w": Strip debug info and symbol table 106 - GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -ldflags "-s -w" -o private-location ./cmd/server 107 108 # Runtime stage 109 fromImage: alpine:3.21 110 111 # Metadata labels 112 label: 113 org.opencontainers.image.title: OpenStatus Private Location 114 org.opencontainers.image.description: Private location orchestrator for OpenStatus 115 org.opencontainers.image.source: https://github.com/openstatusHQ/openstatus 116 org.opencontainers.image.vendor: OpenStatus 117 org.opencontainers.image.authors: OpenStatus Team 118 workdir: /opt/bin 119 120 # Copy artifacts from builder 121 copy: 122 - fromBuilder: builder 123 source: /etc/ssl/certs/ca-certificates.crt 124 target: /etc/ssl/certs/ 125 - fromBuilder: builder 126 source: /usr/share/zoneinfo 127 target: /usr/share/zoneinfo 128 - fromBuilder: builder 129 source: /go/src/app/private-location 130 target: /opt/bin/private-location 131 132 env: 133 TZ: UTC 134 USER: "1000" 135 GIN_MODE: release 136 137 # Security: run as non-root user 138 user: "1000:1000" 139 140 # Expose port 141 expose: "8080" 142 143 # Health check 144 healthcheck: 145 interval: 15s 146 timeout: 10s 147 start: 30s 148 retries: 3 149 cmd: wget --spider -q http://localhost:8080/health || exit 1 150 151 # Start application 152 cmd: 153 - /opt/bin/private-location