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
32 changes: 32 additions & 0 deletions .github/workflows/docker-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "docker-release"

on:
push:
tags:
- "v*.*.*"

jobs:
build-and-push:
permissions:
contents: "read"

runs-on: "ubuntu-latest"
steps:
- name: "Authorize Container Registry"
uses: "docker/login-action@v3.4.0"
with:
registry: "${{ secrets.AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com"
username: "${{ secrets.AWS_ACCESS_KEY_ID }}"
password: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"

- name: "Setup Build Environment"
uses: "docker/setup-buildx-action@v3.10.0"

- name: "Push Docker Image"
uses: "docker/build-push-action@v6.16.0"
with:
push: true
tags: "${{ secrets.AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ github.event.repository.name }}:${{ github.ref_name }}"
build-args: |
SHA=${{ github.sha }}
TAG=${{ github.ref_name }}
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM golang:1.24 AS build
WORKDIR /build

ARG SHA
ARG TAG

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

COPY main.go main.go
COPY cmd/ cmd/
COPY pkg/ pkg/

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-s -w \
-X 'github.com/0xSplits/specta/pkg/runtime.sha=${SHA}' \
-X 'github.com/0xSplits/specta/pkg/runtime.tag=${TAG}'" \
-a \
-o specta main.go



FROM gcr.io/distroless/static:nonroot
WORKDIR /image

COPY .env .env
COPY --from=build /build/specta .
USER 65532:65532

ENV SPECTA_HTTP_HOST="0.0.0.0"
ENV SPECTA_LOG_LEVEL="info"

ENTRYPOINT ["/image/specta"]
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,18 @@ Go Arch arm64
Go OS darwin
Go Version go1.24.3
```

# Docker

See https://github.com/GoogleContainerTools/distroless

```
docker build \
--build-arg SHA="local-test-sha" \
--build-arg TAG="local-test-tag" \
-t specta:local .
```

```
docker run -e SPECTA_ENVIRONMENT=development -p 7777:7777 specta:local daemon
```
Loading