Skip to content

Commit

Permalink
Feature: apps (#68)
Browse files Browse the repository at this point in the history
* Feature: apps

* Add some endpoints

* Add actions endpoint

* Add series endpoint and tests

* Fix: leaderboard
  • Loading branch information
aopoltorzhicky authored Nov 9, 2024
1 parent 13507fe commit 48ba5a5
Show file tree
Hide file tree
Showing 52 changed files with 3,155 additions and 16 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,22 @@ jobs:
cache-to: type=gha,mode=max
tags: ${{ steps.meta-api.outputs.tags }}
labels: ${{ steps.meta-api.outputs.labels }}

# Private API

- name: API image tags & labels
id: private-api
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-private-api

- name: Private API image build & push
uses: docker/build-push-action@v5
with:
context: .
file: build/private_api/Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta-api.outputs.tags }}
labels: ${{ steps.meta-api.outputs.labels }}
13 changes: 12 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
"../../configs/dipdup.yml",
],
"envFile": "${workspaceFolder}/.env"
}
},{
"name": "Launch Private API",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/cmd/private_api",
"args": [
"-c",
"../../configs/dipdup.yml",
],
"envFile": "${workspaceFolder}/.env"
},
]
}
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ indexer:
api:
cd cmd/api && go run . -c ../../configs/dipdup.yml

private_api:
cd cmd/private_api && go run . -c ../../configs/dipdup.yml

generate:
go generate -v ./internal/storage ./internal/storage/types ./pkg/node

Expand All @@ -34,4 +37,4 @@ license-header:
build:
docker-compose up -d --build

.PHONY: indexer api generate test lint cover api-docs ga license-header build
.PHONY: indexer api generate test lint cover api-docs ga license-header build private_api
38 changes: 38 additions & 0 deletions build/private_api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ---------------------------------------------------------------------
# The first stage container, for building the application
# ---------------------------------------------------------------------
FROM golang:1.23-alpine as builder

ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOOS=linux

RUN apk --no-cache add ca-certificates
RUN apk add --update git

RUN mkdir -p $GOPATH/src/github.com/celenium-io/astria-indexer/

COPY ./go.* $GOPATH/src/github.com/celenium-io/astria-indexer/
WORKDIR $GOPATH/src/github.com/celenium-io/astria-indexer
RUN go mod download

COPY cmd/private_api cmd/private_api
COPY internal internal
COPY pkg pkg

WORKDIR $GOPATH/src/github.com/celenium-io/astria-indexer/cmd/private_api/
RUN go build -a -installsuffix cgo -o /go/bin/private_api .

# ---------------------------------------------------------------------
# The second stage container, for running the application
# ---------------------------------------------------------------------
FROM scratch

WORKDIR /app/private_api

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/bin/private_api /go/bin/private_api
COPY ./configs/dipdup.yml ./
COPY database database

ENTRYPOINT ["/go/bin/private_api", "-c", "dipdup.yml"]
239 changes: 239 additions & 0 deletions cmd/api/docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 48ba5a5

Please sign in to comment.