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
38 changes: 38 additions & 0 deletions .github/workflows/production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Production
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # Runs only on semantic versioning tags (vMAJOR.MINOR.PATCH)

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

jobs:
deploy:
name: "Build docker and publish to ECR"
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: assets/assets-api
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${{ github.ref_name }} .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:${{ github.ref_name }}
2 changes: 1 addition & 1 deletion .github/workflows/staging.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Staging

on:
pull_request:
push:
branches:
- main
paths:
Expand Down
4 changes: 3 additions & 1 deletion packages/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ RUN go build -o ./build/bin/api ./cmd/main.go

FROM alpine

ARG SERVER_PORT=8000

COPY --from=builder go/src/api/build/bin/api /usr/local/bin

WORKDIR /usr/local/bin

EXPOSE 8000
EXPOSE ${SERVER_PORT}

RUN apk --no-cache add ca-certificates

Expand Down
5 changes: 4 additions & 1 deletion packages/api/pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func NewService(assetsApp *app.AssetsApp, polkadotMiddleware *polkadotMiddleware
}

func (srv *Service) Setup() {

router := chi.NewRouter()
cfg := srv.assetsApp.Config()
router.Use(middleware.Recoverer)
Expand All @@ -66,6 +65,10 @@ func (srv *Service) Setup() {
MaxAge: 300,
}).Handler)

router.Get("/health", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})

router.Get("/nonce", srv.CreateToken)
router.With(httpin.NewInput(model.UploadImageInput{})).Post("/upload", srv.UploadImage)
router.With(
Expand Down
Loading