gRPC + SQLite (modernc) Microservice
This is a small example microservice written in Go.
It exposes a gRPC API and stores data in a local SQLite database using the pure-Go modernc.org/sqlite driver. No CGO, fast builds, minimal images.
Prerequisite
Project Layout
├── .github/workflows/docker.yaml # minimal GitHub Action workflow for publishing to docker hub
├── proto/rdpc.proto # protobufs declarations
├── server/main.go # concrete implementation
├── client/main.go # client to test if the server is working
├── Dockerfile # example of a minimal Docker image
└── Makefile # includes gen-proto command to generate the protofiles
GitHub workflow
name: build-and-push-arm
on:
push:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v6
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build images
run: |
IMAGE="vyary/rdpc-arm"
SHA_TAG="${IMAGE}:${{ github.sha }}"
LATEST_TAG="${IMAGE}:latest"
docker build -t "$SHA_TAG" -t "$LATEST_TAG" .
- name: Push images
run: |
IMAGE="vyary/rdpc-arm"
docker push "${IMAGE}:${{ github.sha }}"
docker push "${IMAGE}:latest"
Docker example
FROM golang:1.25.1 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o app ./server/
FROM scratch
COPY --from=builder /app/app /app
ENTRYPOINT ["/app"]