diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..c381fc0f5 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,9 @@ +/api/ @formancehq/dev-backend +/cmd/ @formancehq/dev-backend +/config/ @formancehq/dev-backend +/core/ @formancehq/dev-backend +/ledger/ @formancehq/dev-backend +*.go @formancehq/dev-backend + +/.devcontainer @flemzord +/.github @flemzord diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..f7757cdf9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Logs** +If applicable, add logs to help explain your problem. + +**Environment (please complete the following information):** + - OS: [e.g. ubuntu 20.04] + - Numary Version [e.g. 1.0.0-beta.4] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..b36319bac --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,22 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement, rfc +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Summary** + +**Solution proposal** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_sdk_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_sdk_template.md new file mode 100644 index 000000000..3f9f8c2a9 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_sdk_template.md @@ -0,0 +1,8 @@ +# SDK : OPEN API GENERATOR NAME + +__Please add a description to this PR.__ + +## How to deploy + +__Please provide steps to deploy the generated sdk to official channels.__ +__Please be as exhaustive as possible__ diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 000000000..3d9bbad90 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,22 @@ +# Title + +__Please add a description to this PR.__ + +## Type of change + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Refactoring / Technical debt + +## What parts of the code are impacted ? +__Please describe the impacted parts of the code.__ + +# Checklist: + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..cd51d2c60 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "daily" diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..66ae675cd --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,23 @@ +'@domain/core': + - core/* + - core/**/* + +'@domain/api': + - api/* + - api/**/* + +'@domain/ledger': + - ledger/* + - ledger/**/* + +'@domain/storage': + - storage/* + - storage/**/* + +'@domain/cmd': + - cmd/* + - cmd/**/* + +'@domain/ci': + - .github/* + - .github/**/* diff --git a/.github/workflows/benchmarks.yaml b/.github/workflows/benchmarks.yaml new file mode 100644 index 000000000..ec4a1ef34 --- /dev/null +++ b/.github/workflows/benchmarks.yaml @@ -0,0 +1,18 @@ +name: Benchmarks +on: + workflow_dispatch + +jobs: + bench: + runs-on: ubuntu-latest + steps: + - name: Install task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: 'go.mod' + - name: Run bench + run: task install:perf bench diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..773d9fba0 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,33 @@ +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '35 21 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..59f0af52d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,75 @@ +on: + push: + branches: + - main + pull_request: + types: [ assigned, opened, synchronize, reopened ] + release: + types: [ prereleased, released ] + +name: Main +jobs: + Pr: + if: github.event_name == 'pull_request' + uses: formancehq/gh-workflows/.github/workflows/pr-style.yml@main + + Control: + name: 'Control' + uses: ./.github/workflows/template_build-control.yaml + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + + GoReleaserBuild: + if: github.event_name != 'release' + name: 'GoReleaser Build' + uses: ./.github/workflows/template_goreleaser-build.yaml + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + + GoReleaserRelease: + if: github.event_name == 'release' + name: 'GoReleaser Release' + uses: ./.github/workflows/template_goreleaser-release.yaml + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + FURY_TOKEN: ${{ secrets.FURY_TOKEN }} + + SdkGenerate: + needs: + - GoReleaserBuild + uses: ./.github/workflows/template_sdk-generate.yaml + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + + SdkPublish: + needs: + - GoReleaserRelease + uses: ./.github/workflows/template_sdk-publish.yaml + with: + VERSION: ${{ github.event.release.tag_name }} + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + + DockerRelease: + if: github.event_name == 'release' + uses: ./.github/workflows/template_docker.yaml + with: + VERSION: ${{ github.event.release.tag_name }} + APP_SHA: ${{ github.sha }} + RELEASE: ${{ github.event.action }} + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + + DockerBranch: + if: github.event_name != 'release' + uses: ./.github/workflows/template_docker.yaml + with: + VERSION: develop + APP_SHA: ${{ github.sha }} + RELEASE: ${{ github.event.action }} + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} diff --git a/.github/workflows/pr_open_target.yml b/.github/workflows/pr_open_target.yml new file mode 100644 index 000000000..3caf1e330 --- /dev/null +++ b/.github/workflows/pr_open_target.yml @@ -0,0 +1,12 @@ +name: "Pull Request Labeler" +on: + - pull_request_target +# - pull_request + +jobs: + Triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v3 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/template_build-control.yaml b/.github/workflows/template_build-control.yaml new file mode 100644 index 000000000..86b3f7eb9 --- /dev/null +++ b/.github/workflows/template_build-control.yaml @@ -0,0 +1,20 @@ +name: Build for Control +on: + workflow_call: + secrets: + NUMARY_GITHUB_TOKEN: + required: true + description: GitHub token with access to the repo + +jobs: + build: + name: 'Build Control' + runs-on: ubuntu-latest + steps: + - run: curl -OL https://github.com/numary/control/releases/download/1.2.0/numary-control-1.2.0.tar.gz + - run: tar -zxvf numary-control-1.2.0.tar.gz + - run: rm -rf numary-control-1.2.0.tar.gz + - uses: actions/upload-artifact@v2 + with: + name: control-dist + path: ./** diff --git a/.github/workflows/template_docker.yaml b/.github/workflows/template_docker.yaml new file mode 100644 index 000000000..50f774c0f --- /dev/null +++ b/.github/workflows/template_docker.yaml @@ -0,0 +1,81 @@ +name: Docker Build & Publish +on: + workflow_call: + inputs: + VERSION: + type: string + required: true + description: The tag name to use for Docker. + APP_SHA: + type: string + required: true + description: The sha to use for Docker. + RELEASE: + type: string + required: true + description: Whether to release the Docker image. + secrets: + NUMARY_GITHUB_TOKEN: + required: true + description: GitHub token with access to the repo + SEGMENT_WRITE_KEY_OSS: + required: true + description: Segment write key for the OSS repo + +jobs: + Docker: + name: 'Build & Publish Docker' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: fetch numary control + uses: actions/download-artifact@v2 + with: + name: control-dist + path: cmd/control/ + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: "NumaryBot" + password: ${{ secrets.NUMARY_GITHUB_TOKEN }} + - name: Build and push Released + if: inputs.RELEASE == 'released' + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/formancehq/ledger:latest,ghcr.io/formancehq/ledger:${{ inputs.VERSION }} + build-args: | + APP_SHA=${{ inputs.APP_SHA }} + VERSION=${{ inputs.VERSION }} + SEGMENT_WRITE_KEY=${{ secrets.SEGMENT_WRITE_KEY_OSS }} + - name: Build and push PreReleased + if: inputs.RELEASE == 'prereleased' + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/formancehq/ledger:${{ inputs.VERSION }} + build-args: | + APP_SHA=${{ inputs.APP_SHA }} + VERSION=${{ inputs.VERSION }} + SEGMENT_WRITE_KEY=${{ secrets.SEGMENT_WRITE_KEY_OSS }} + - name: Build and push + if: inputs.RELEASE != 'released' || inputs.RELEASE != 'prereleased' + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/formancehq/ledger:${{ inputs.APP_SHA }} + build-args: | + APP_SHA=${{ inputs.APP_SHA }} + VERSION=${{ inputs.VERSION }} + SEGMENT_WRITE_KEY=${{ secrets.SEGMENT_WRITE_KEY_OSS }} diff --git a/.github/workflows/template_goreleaser-build.yaml b/.github/workflows/template_goreleaser-build.yaml new file mode 100644 index 000000000..547bcee24 --- /dev/null +++ b/.github/workflows/template_goreleaser-build.yaml @@ -0,0 +1,53 @@ +name: GoReleaser Build +on: + workflow_call: + secrets: + NUMARY_GITHUB_TOKEN: + required: true + description: GitHub token with access to the repo + SEGMENT_WRITE_KEY_OSS: + required: true + description: Segment write key for the OSS repo + +jobs: + goreleaser: + name: GoReleaser Build + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: 'go.mod' + cache: true + - name: fetch numary control + uses: actions/download-artifact@v2 + with: + name: control-dist + path: cmd/control/ + - run: sudo apt install gcc-aarch64-linux-gnu gcc-mingw-w64 -y + if: ${{ matrix.os == 'ubuntu-latest' }} + - name: Run GoReleaser for Linux + if: ${{ matrix.os == 'ubuntu-latest' }} + uses: goreleaser/goreleaser-action@v4 + with: + version: latest + args: build --parallelism 4 --rm-dist --skip-validate --snapshot + env: + GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + - name: Run GoReleaser for MacOS + if: ${{ matrix.os == 'macos-latest' }} + uses: goreleaser/goreleaser-action@v4 + with: + version: latest + args: build -f .goreleaser-darwin.yml --parallelism 4 --rm-dist --skip-validate --snapshot + env: + GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + - uses: actions/upload-artifact@v2 + with: + name: dist + path: ./dist/** diff --git a/.github/workflows/template_goreleaser-release.yaml b/.github/workflows/template_goreleaser-release.yaml new file mode 100644 index 000000000..141a6f2f7 --- /dev/null +++ b/.github/workflows/template_goreleaser-release.yaml @@ -0,0 +1,65 @@ +name: GoReleaser Release +on: + workflow_call: + secrets: + NUMARY_GITHUB_TOKEN: + required: true + description: GitHub token with access to the repo + SEGMENT_WRITE_KEY_OSS: + required: true + description: Segment write key for the OSS repo + FURY_TOKEN: + required: true + description: Fury token for the OSS repo + +jobs: + goreleaser: + name: GoReleaser Build + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + runs-on: ${{ matrix.os }} + env: + DOCKER_CLI_EXPERIMENTAL: "enabled" + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v3 + with: + go-version-file: 'go.mod' + cache: true + - name: fetch numary control + uses: actions/download-artifact@v2 + with: + name: control-dist + path: cmd/control/ + - run: sudo apt install gcc-aarch64-linux-gnu gcc-mingw-w64 -y + if: ${{ matrix.os == 'ubuntu-latest' }} + - name: Run GoReleaser for Linux + if: ${{ matrix.os == 'ubuntu-latest' }} + env: + GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + FURY_TOKEN: ${{ secrets.FURY_TOKEN }} + SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + uses: goreleaser/goreleaser-action@v4 + with: + version: latest + args: release --rm-dist + - name: Run GoReleaser for MacOS + if: ${{ matrix.os == 'macos-latest' }} + env: + GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + FURY_TOKEN: ${{ secrets.FURY_TOKEN }} + SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + uses: goreleaser/goreleaser-action@v4 + with: + version: latest + args: release -f .goreleaser-darwin.yml --rm-dist + - uses: actions/cache@v2 + with: + path: | + ./dist/*.deb + ./dist/*.rpm + ./dist/*.apk + key: ${{ runner.os }}-go-${{ hashFiles('**/*.go') }}-${{ hashFiles('**/go.sum') }} diff --git a/.github/workflows/template_sdk-generate.yaml b/.github/workflows/template_sdk-generate.yaml new file mode 100644 index 000000000..d38bdcc4d --- /dev/null +++ b/.github/workflows/template_sdk-generate.yaml @@ -0,0 +1,35 @@ +name: SDK Generate +on: + workflow_call: + secrets: + NUMARY_GITHUB_TOKEN: + required: true + description: GitHub token with access to the repo + +jobs: + Sdk: + name: 'Generate SDK' + runs-on: ubuntu-latest + strategy: + matrix: + sdk: [ go, php, python, typescript-node, java ] + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.NUMARY_GITHUB_TOKEN }} + ref: ${{ inputs.VERSION }} + - uses: actions/checkout@v3 + with: + token: ${{ secrets.NUMARY_GITHUB_TOKEN }} + repository: formancehq/numary-sdk-${{ matrix.sdk }} + path: sdks/${{ matrix.sdk }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Install Task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Launch Generate + run: task sdk:generate VERSION=main -- ${{ matrix.sdk }} diff --git a/.github/workflows/template_sdk-publish.yaml b/.github/workflows/template_sdk-publish.yaml new file mode 100644 index 000000000..e15dff219 --- /dev/null +++ b/.github/workflows/template_sdk-publish.yaml @@ -0,0 +1,57 @@ +name: SDK Publish +on: + workflow_dispatch: + inputs: + VERSION: + type: string + required: true + description: Version of the SDK to publish + workflow_call: + inputs: + VERSION: + type: string + required: true + description: Version of the SDK to publish + secrets: + NUMARY_GITHUB_TOKEN: + required: true + description: GitHub token with access to the repo + +jobs: + Sdk: + name: 'Publish SDK' + runs-on: ubuntu-latest + strategy: + matrix: + sdk: [ go, php, python, typescript-node, java ] + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.NUMARY_GITHUB_TOKEN }} + - uses: actions/checkout@v3 + with: + token: ${{ secrets.NUMARY_GITHUB_TOKEN }} + repository: numary/numary-sdk-${{ matrix.sdk }} + path: ./sdk/sdks/${{ matrix.sdk }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Install Task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Launch Generate + run: task sdk:generate VERSION=${{ inputs.VERSION }} -- ${{ matrix.sdk }} + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Upgrade Release to ${{ inputs.VERSION }} + create_branch: true + branch: release/${{ inputs.VERSION }} + repository: ./sdk/sdks/${{ matrix.sdk }} + commit_user_name: NumaryBot + commit_user_email: support@numary.com + - run: gh pr create --base main --head release/${{ inputs.VERSION }} --title "Upgrade to ${{ inputs.VERSION }}" --body "Upgrade to ${{ inputs.VERSION }}" + working-directory: ./sdk/sdks/${{ matrix.sdk }} + env: + GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index bd4419142..51beb5193 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,4 +1,10 @@ project_name: numary +env: + - GO111MODULE=on + - GOPROXY=https://proxy.golang.org +before: + hooks: + - go mod download builds: - binary: numary @@ -73,7 +79,7 @@ archives: checksum: - name_template: '{{.ProjectName}}_checksums.txt' + name_template: 'checksums.txt' snapshot: name_template: "{{ .Tag }}" @@ -103,9 +109,11 @@ changelog: release: prerelease: auto footer: | + ## Want to try this version ? + [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/numary/ledger/tree/{{ .Tag }}&version={{ .Tag }}) ## What to do next? - - Read the [documentation](https://docs.formance.com/) - - Join our [Slack server](https://formance.com/slack) + - Read the [documentation](https://docs.numary.com/oss/ledger/get-started/installation) + - Join our [Discord server](https://discord.gg/xyHvcbzk4w) nfpms: - id: packages @@ -126,42 +134,3 @@ publishers: - packages dir: "{{ dir .ArtifactPath }}" cmd: curl -F package=@{{ .ArtifactName }} https://{{ .Env.FURY_TOKEN }}@push.fury.io/numary/ - - -dockers: - - image_templates: ["ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-amd64"] - dockerfile: Dockerfile - use: buildx - build_flag_templates: - - --platform=linux/amd64 - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/formancehq/stack - - --label=org.opencontainers.image.source=https://github.com/formancehq/stack - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - --label=org.opencontainers.image.licenses=MIT - - image_templates: [ "ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-arm64" ] - goarch: arm64 - dockerfile: Dockerfile - use: buildx - build_flag_templates: - - --platform=linux/arm64/v8 - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/formancehq/stack - - --label=org.opencontainers.image.source=https://github.com/formancehq/stack - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - --label=org.opencontainers.image.licenses=MIT -docker_manifests: - - name_template: ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }} - image_templates: - - ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-amd64 - - ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-arm64 - - name_template: ghcr.io/formancehq/{{ .ProjectName }}:latest - image_templates: - - ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-amd64 - - ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-arm64 diff --git a/Dockerfile b/Dockerfile index 7894421ff..327659b9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,9 +9,14 @@ ARG TARGETARCH ARG APP_SHA ARG VERSION ARG SEGMENT_WRITE_KEY -WORKDIR /src +WORKDIR /go/src/github.com/numary/ledger +# get deps first so it's cached +COPY go.mod . +COPY go.sum . +RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \ + --mount=type=cache,id=gobuild,target=/root/.cache/go-build \ + go mod download COPY . . -RUN go mod download RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \ --mount=type=cache,id=gobuild,target=/root/.cache/go-build \ CGO_ENABLED=1 GOOS=linux GOARCH=$TARGETARCH \ @@ -24,7 +29,7 @@ RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \ FROM ubuntu:jammy as app RUN apt update && apt install -y ca-certificates wget && rm -rf /var/lib/apt/lists/* -COPY --from=builder /src/numary /usr/local/bin/numary +COPY --from=builder /go/src/github.com/numary/ledger/numary /usr/local/bin/numary EXPOSE 3068 ENTRYPOINT ["numary"] ENV OTEL_SERVICE_NAME ledger