Skip to content

Commit

Permalink
Base code for backend
Browse files Browse the repository at this point in the history
Signed-off-by: KayleCoder <kalecoder@outlook.com>
  • Loading branch information
KayleCoder committed Jan 12, 2024
1 parent 0d5c772 commit e2f8daa
Show file tree
Hide file tree
Showing 11 changed files with 16,983 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT=3000
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: ethda-faucet (main)

on:
workflow_dispatch:
push:
branches: [ "main" ]
jobs:
build:
if: github.repository == 'crustio/ethda-backend'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- uses: actions/cache@v3
with:
path: |
.yarn/cache
./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get current date
id: date
run: echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV

- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: |
gavfu/ethda-backend:latest
gavfu/ethda-backend:${{ env.date }}
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# base image for local development
FROM node:18
WORKDIR /app
COPY dist ./dist
COPY node_modules ./node_modules
CMD ["node", "./dist/index.js"]
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# ethda-backend
# ethda-backend

## Configuration

ethda-backend is configured using environment variables. You can define them using export or with an .env file.

We provide a .env.example file as reference which you can use as starting point.

```sell
cp .env.example .env
```

## Running ethda-backend locally

Install dependencies

```sell
npm install
```

Start server

```sell
npm run dev
```


12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
version: "3.7"

services:
indexer:
image: gavfu/ethda-backend:latest
network_mode: host
restart: always
env_file:
- ".env"
ports:
- 30002:3000
Loading

0 comments on commit e2f8daa

Please sign in to comment.