Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Add GOBIN to PATH
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"

- name: Generate protobuf bindings
- name: Generate protobuf stubs
run: |
buf export buf.build/agynio/api --output internal/.proto
buf generate internal/.proto --template ./buf.gen.yaml
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ jobs:
with:
go-version: '1.22.x'

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64

- uses: docker/setup-buildx-action@v3

- name: Install system dependencies
Expand All @@ -47,7 +52,7 @@ jobs:
- name: Set release version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"

- name: Generate protobufs
- name: Generate protobuf stubs
run: |
buf export buf.build/agynio/api --output internal/.proto
buf generate internal/.proto --template ./buf.gen.yaml
Expand All @@ -66,13 +71,14 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push release images
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
Comment thread
noa-lucent marked this conversation as resolved.
push: true
tags: |
ghcr.io/agynio/token-counting:${{ env.VERSION }}
ghcr.io/agynio/token-counting:${{ github.ref_name }}
ghcr.io/agynio/token-counting:latest
Comment thread
noa-lucent marked this conversation as resolved.
ghcr.io/agynio/token-counting:${{ github.sha }}

Expand Down
25 changes: 7 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
# syntax=docker/dockerfile:1.8

FROM golang:1.22 AS builder

ARG TARGETOS
ARG TARGETARCH

ENV CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
GOBIN=/usr/local/bin

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] GOBIN=/usr/local/bin is now unused — there are no go install commands left in the Dockerfile. Consider removing it to keep the Dockerfile minimal.


RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
protobuf-compiler && \
rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://github.com/bufbuild/buf/releases/download/v1.64.0/buf-Linux-x86_64.tar.gz \
| tar -xzf - -C /usr/local --strip-components=1 buf/bin/buf

RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2 && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1

WORKDIR /workspace

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN buf export buf.build/agynio/api --output internal/.proto && \
buf generate internal/.proto --template ./buf.gen.yaml

RUN go build -o /out/token-counting ./cmd/token-counting
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -trimpath -ldflags "-s -w" -o /out/token-counting ./cmd/token-counting

FROM gcr.io/distroless/static-debian12

Expand Down