From a7c0bbbd04308a54fb7ff0ca2b756f6ce9565dd8 Mon Sep 17 00:00:00 2001 From: file-diff-agent Date: Wed, 29 Apr 2026 21:19:34 +0000 Subject: [PATCH 1/2] Initialize agent task: Finish docker-compose actions by creating and pushing docker. Check to u Finish docker-compose actions by creating and pushing docker. Check to use the newest versions of the actions. I want commit number as a tag. If pushed to main mark as latest. From 4482ba0f659a7acf3433a767cac59b80ab0a1612 Mon Sep 17 00:00:00 2001 From: file-diff-agent Date: Wed, 29 Apr 2026 21:24:51 +0000 Subject: [PATCH 2/2] Add Docker image publishing workflow --- .dockerignore | 8 ++++++ .github/workflows/ci.yml | 53 ++++++++++++++++++++++++++++++++++++---- Dockerfile | 26 ++++++++++++++++++++ README.md | 12 +++++++++ docker-compose.yml | 21 ++++++++++++++++ 5 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..da5ca6d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +.github +bin +arkiv-storaged +tmp +*.log +Dockerfile +docker-compose.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9a5e96..78c9847 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..64484ed --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index b8d0334..850d67b 100644 --- a/README.md +++ b/README.md @@ -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 `/config.yaml`. Command-line flags take precedence over file values. Example: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6e9ef9d --- /dev/null +++ b/docker-compose.yml @@ -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: