Skip to content

Commit 7bc4daa

Browse files
authored
chore: add microservice architecture scaffolding (#7)
* chore: add microservice architecture scaffolding Add Dockerfile, .dockerignore, .env.example, api/openapi.yaml, deploy/docker/docker-compose.yml, docs/architecture.md, and .github/workflows/docker.yml for GHCR build+push CI. * fix: resolve lint and markdown CI failures Remove unused func indexCI from shrink package and fix empty badge links in architecture.md that triggered MD042. * style: gofumpt format shrink.go
1 parent f462882 commit 7bc4daa

8 files changed

Lines changed: 623 additions & 17 deletions

File tree

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.git
2+
.github
3+
.gitignore
4+
*.md
5+
.env
6+
.env.*
7+
Dockerfile
8+
.dockerignore
9+
coverage.out
10+
docs/
11+
deploy/
12+
api/

.env.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# eyrie environment variables — copy to .env and fill in
2+
EYRIE_API_KEY=
3+
EYRIE_ALLOW_INSECURE_PUBLIC_API=false
4+
OPENAI_API_KEY=
5+
ANTHROPIC_API_KEY=
6+
GEMINI_API_KEY=
7+
OPENROUTER_API_KEY=
8+
CANOPYWAVE_API_KEY=
9+
XAI_API_KEY=
10+
ZAI_API_KEY=
11+
OPENAI_MODEL=gpt-4o
12+
ANTHROPIC_MODEL=claude-sonnet-4-5
13+
GEMINI_MODEL=gemini-2.0-flash
14+
HAWK_CONFIG_DIR=~/.eyrie

.github/workflows/docker.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [main]
9+
paths:
10+
- "Dockerfile"
11+
- "**.go"
12+
- "go.mod"
13+
- "go.sum"
14+
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
env:
20+
REGISTRY: ghcr.io
21+
IMAGE_NAME: graycodeai/eyrie
22+
23+
jobs:
24+
build-and-push:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Log in to GHCR
33+
if: github.event_name != 'pull_request'
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Docker metadata
41+
id: meta
42+
uses: docker/metadata-action@v5
43+
with:
44+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
tags: |
46+
type=ref,event=branch
47+
type=semver,pattern={{version}}
48+
type=semver,pattern={{major}}.{{minor}}
49+
type=sha,prefix=sha-
50+
51+
- name: Build and push
52+
uses: docker/build-push-action@v6
53+
with:
54+
context: .
55+
push: ${{ github.event_name != 'pull_request' }}
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}
58+
cache-from: type=gha
59+
cache-to: type=gha,mode=max
60+
build-args: |
61+
VERSION=${{ github.ref_name }}
62+
COMMIT=${{ github.sha }}
63+
BUILD_DATE=${{ github.event.head_commit.timestamp }}

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM golang:1.26.3-alpine AS builder
2+
3+
RUN apk add --no-cache git ca-certificates tzdata
4+
5+
WORKDIR /build
6+
COPY go.mod go.sum ./
7+
RUN go mod download && go mod verify
8+
9+
COPY . .
10+
ARG VERSION=dev
11+
ARG COMMIT=none
12+
ARG BUILD_DATE=unknown
13+
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath \
14+
-ldflags="-s -w \
15+
-X main.Version=${VERSION} \
16+
-X main.Commit=${COMMIT} \
17+
-X main.BuildDate=${BUILD_DATE}" \
18+
-o eyrie ./cmd/eyrie
19+
20+
FROM alpine:3.21
21+
RUN apk add --no-cache ca-certificates tini && \
22+
adduser -D -u 1000 -h /data eyrie
23+
24+
COPY --from=builder /build/eyrie /usr/local/bin/eyrie
25+
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
26+
27+
USER eyrie
28+
WORKDIR /data
29+
EXPOSE 8080
30+
31+
ENTRYPOINT ["tini", "--", "eyrie"]
32+
CMD ["serve", "8080"]

0 commit comments

Comments
 (0)