Skip to content
Closed
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
.github
bin
arkiv-storaged
tmp
*.log
Dockerfile
docker-compose.yml
53 changes: 48 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@ name: CI

on:
push:
branches: [main, develop]
branches: ['**']
pull_request:
branches: [main, develop]

permissions:
contents: read
packages: write

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6.0.2

- uses: actions/setup-go@v5
- uses: actions/setup-go@v6.4.0
with:
go-version: '1.26.0'
go-version: '1.26.2'
cache: true

- uses: golangci/golangci-lint-action@v9
- uses: golangci/golangci-lint-action@v9.2.0
with:
version: latest

Expand All @@ -26,3 +30,42 @@ jobs:

- name: Test
run: go test ./...

docker:
runs-on: ubuntu-latest
needs: ci
steps:
- uses: actions/checkout@v6.0.2

- name: Set image name
run: echo "IMAGE_NAME=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"

- name: Validate Docker Compose
run: docker compose config

- uses: docker/setup-buildx-action@v4.0.0

- name: Log in to GHCR
if: github.event_name == 'push'
uses: docker/login-action@v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v6.0.0
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.sha }}
type=raw,value=latest,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

- name: Build and push Docker image
uses: docker/build-push-action@v7.1.0
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# syntax=docker/dockerfile:1

ARG GO_VERSION=1.26.2

FROM golang:${GO_VERSION}-bookworm AS build

WORKDIR /src

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

COPY . .
RUN mkdir -p /out/data && \
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/arkiv-storaged ./cmd/arkiv-storaged

FROM gcr.io/distroless/static-debian12:nonroot

COPY --from=build /out/arkiv-storaged /usr/local/bin/arkiv-storaged
COPY --from=build --chown=nonroot:nonroot /out/data /data

USER nonroot:nonroot
VOLUME ["/data"]
EXPOSE 2704 2705

ENTRYPOINT ["/usr/local/bin/arkiv-storaged"]
CMD ["-data-dir", "/data"]
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ Flags:
-data-dir path to the data directory (default ~/.arkiv-storaged)
```

Run it with Docker Compose:

```sh
docker compose up --build
```

The compose service exposes the chain ingest server on `2704`, the query server
on `2705`, and stores data in the `arkiv-storaged-data` volume.

Images are published to `ghcr.io/arkiv-network/arkiv-storage-service` with the
full commit SHA as the tag. Pushes to `main` also publish `latest`.

### Configuration file

On startup `arkiv-storaged` reads `<data-dir>/config.yaml`. Command-line flags take precedence over file values. Example:
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
arkiv-storaged:
image: ghcr.io/arkiv-network/arkiv-storage-service:latest
build:
context: .
command:
- "-data-dir"
- "/data"
- "-chain-addr"
- ":2704"
- "-query-addr"
- ":2705"
ports:
- "2704:2704"
- "2705:2705"
volumes:
- arkiv-storaged-data:/data
restart: unless-stopped

volumes:
arkiv-storaged-data: