Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: apps #68

Merged
merged 5 commits into from
Nov 9, 2024
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
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
Loading