chain gateway build fix
All checks were successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/fx/1 Pipeline was successful
ci/woodpecker/push/fx/2 Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful

This commit is contained in:
Stephan D
2025-11-11 13:56:21 +01:00
parent 052cfcea4c
commit 40a3460e6d
7 changed files with 466 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
# syntax=docker/dockerfile:1.7
ARG TARGETOS=linux
ARG TARGETARCH=amd64
FROM golang:alpine AS build
ARG APP_VERSION=dev
ARG GIT_REV=unknown
ARG BUILD_BRANCH=unknown
ARG BUILD_DATE=unknown
ARG BUILD_USER=ci
ENV GO111MODULE=on
ENV PATH="/go/bin:${PATH}"
WORKDIR /src
COPY . .
RUN apk add --no-cache bash git build-base protoc protobuf-dev \
&& go install google.golang.org/protobuf/cmd/protoc-gen-go@latest \
&& go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest \
&& bash ci/scripts/proto/generate.sh
WORKDIR /src/api/ledger
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -trimpath -ldflags "\
-s -w \
-X github.com/tech/sendico/ledger/internal/appversion.Version=${APP_VERSION} \
-X github.com/tech/sendico/ledger/internal/appversion.Revision=${GIT_REV} \
-X github.com/tech/sendico/ledger/internal/appversion.Branch=${BUILD_BRANCH} \
-X github.com/tech/sendico/ledger/internal/appversion.BuildUser=${BUILD_USER} \
-X github.com/tech/sendico/ledger/internal/appversion.BuildDate=${BUILD_DATE}" \
-o /out/ledger .
FROM alpine:latest AS runtime
RUN apk add --no-cache ca-certificates tzdata wget
WORKDIR /app
COPY api/ledger/config.yml /app/config.yml
COPY --from=build /out/ledger /app/ledger
EXPOSE 50052 9401
ENTRYPOINT ["/app/ledger"]
CMD ["--config.file", "/app/config.yml"]

View File

@@ -0,0 +1,46 @@
# Compose v2 - Ledger service
x-common-env: &common-env
env_file:
- ../env/.env.runtime
- ../env/.env.version
networks:
sendico-net:
external: true
name: sendico-net
services:
sendico_ledger:
<<: *common-env
container_name: sendico-ledger
restart: unless-stopped
image: ${REGISTRY_URL}/ledger/service:${APP_V}
pull_policy: always
environment:
LEDGER_MONGO_HOST: ${LEDGER_MONGO_HOST}
LEDGER_MONGO_PORT: ${LEDGER_MONGO_PORT}
LEDGER_MONGO_DATABASE: ${LEDGER_MONGO_DATABASE}
LEDGER_MONGO_USER: ${LEDGER_MONGO_USER}
LEDGER_MONGO_PASSWORD: ${LEDGER_MONGO_PASSWORD}
LEDGER_MONGO_AUTH_SOURCE: ${LEDGER_MONGO_AUTH_SOURCE}
LEDGER_MONGO_REPLICA_SET: ${LEDGER_MONGO_REPLICA_SET}
LEDGER_GRPC_PORT: ${LEDGER_GRPC_PORT}
LEDGER_METRICS_PORT: ${LEDGER_METRICS_PORT}
NATS_URL: ${NATS_URL}
NATS_HOST: ${NATS_HOST}
NATS_PORT: ${NATS_PORT}
NATS_USER: ${NATS_USER}
NATS_PASSWORD: ${NATS_PASSWORD}
command: ["--config.file", "/app/config.yml"]
ports:
- "0.0.0.0:${LEDGER_GRPC_PORT}:50052"
- "0.0.0.0:${LEDGER_METRICS_PORT}:${LEDGER_METRICS_PORT}"
healthcheck:
test: ["CMD-SHELL","wget -qO- http://localhost:${LEDGER_METRICS_PORT}/health | grep -q '\"status\":\"ok\"'"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
- sendico-net