Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
feat(5830): init arns resolver service
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Mar 21, 2024
0 parents commit 61d1bd5
Show file tree
Hide file tree
Showing 23 changed files with 5,303 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"root": true,
"ignorePatterns": ["resources/license.header.js"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json"
},
"plugins": [
"@typescript-eslint",
"header",
"jest-formatting",
"prettier",
"unicorn"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/no-explicit-any": ["off"],
"@typescript-eslint/no-unused-vars": ["off"],
"@typescript-eslint/strict-boolean-expressions": [
2,
{
"allowNullableObject": true,
"allowNullableBoolean": true,
"allowAny": true
}
],
"eqeqeq": 2,
"jest-formatting/padding-around-describe-blocks": 2,
"jest-formatting/padding-around-test-blocks": 2,
"header/header": [2, "./resources/license.header.js"],
"no-console": 0,
"no-return-await": 2,
"no-unneeded-ternary": 2,
"no-unused-vars": "off",
"prettier/prettier": 2,
"unicorn/prefer-node-protocol": 2
}
}
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build / Test / Push

on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
step: ['lint:check', 'build']
steps:
- uses: actions/checkout@v4
- name: Setup yarn
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
- run: yarn --immutable --immutable-cache
- run: yarn
- run: yarn ${{ matrix.step }}

# push:
# needs: [build]
# if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
# runs-on: ubuntu-latest
# permissions:
# id-token: write
# contents: read
# checks: write
# packages: write
# steps:
# - uses: actions/checkout@v3

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2

# - name: Setup Docker buildx
# uses: docker/setup-buildx-action@v2

# - name: Log in to the GitHub Container Registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

# - name: Build and push container image to GitHub Container Registry
# uses: docker/build-push-action@v4
# with:
# push: true
# platforms: linux/amd64,linux/arm64
# # TODO: add build version node args
# tags: |
# ghcr.io/ar-io/arns-resolver:${{ github.sha }}
# ghcr.io/ar-io/arns-resolver:latest

# deploy:
# if: github.ref == 'refs/heads/main'
# needs: [build, push]
# runs-on: ubuntu-latest
# permissions:
# id-token: write
# contents: read
# environment: production
# steps:
# - uses: actions/checkout@v3
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOYMENT_ROLE }}
# aws-region: ${{ secrets.AWS_REGION }}

# - name: Update Service
# run: |
# aws ecs update-service --cluster ${{ secrets.AWS_CLUSTER }} --service ${{ secrets.AWS_SERVICE }} --force-new-deployment --region ${{ secrets.AWS_REGION }}
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.log
/.direnv
/.env
/coverage
/dist
/node_modules
/tmp
/wallets
/data
/cache
/null

# VS Code
/.vscode

# macOS
.DS_Store
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.18.0
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"printWidth": 80,
"trailingComma": "all",
"singleQuote": true,
"tabWidth": 2,
"importOrder": ["<THIRD_PARTY_MODULES>", "^[.{1,2}/]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG NODE_VERSION=18.18.0
ARG NODE_VERSION_SHORT=18

FROM node:${NODE_VERSION}-bullseye-slim AS builder

# Build
WORKDIR /app
COPY . .
RUN yarn && yarn build
RUN rm-rf node_modules & yarn install --force

# Runtime
FROM gcr.io/distroless/nodejs${NODE_VERSION_SHORT}-debian11
WORKDIR /app

# Add sh for healtcheck script
COPY --from=busybox:1.35.0-uclibc /bin/sh /bin/sh

# Copy build files
COPY --from=builder /app/node_modules ./node_modules/
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/healthcheck.sh ./healthcheck.sh
COPY --from=builder /app/docs ./docs/
COPY --from=builder /app/dist ./dist/

# Expose port and add healthcheck
EXPOSE 6000
HEALTHCHECK CMD /bin/sh healthcheck.sh

# Add labels
LABEL org.opencontainers.image.title="ar.io - ArNS Resolver Service"

# Start the server
CMD ["./dist/service.js"]
Loading

0 comments on commit 61d1bd5

Please sign in to comment.