Skip to content

Commit

Permalink
Api deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Boldizsar Mezei committed Oct 12, 2023
1 parent 5231fcd commit bb359ec
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/node_modules
**/lib
**/scripts
21 changes: 21 additions & 0 deletions .github/workflows/api_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Api deploy test

on: pull_request


jobs:
deploy_api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SOONAVERSE_TEST }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: 'Use gcloud CLI'
run: 'gcloud info'
24 changes: 24 additions & 0 deletions packages/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:18

WORKDIR api

RUN apt-get -y update
RUN apt-get -y install libudev-dev
RUN apt-get -y install cmake
RUN apt-get -y install clang
RUN apt-get -y install openssl
RUN apt-get -y install build-essential

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

COPY packages/database packages/database
COPY packages/interfaces packages/interfaces
COPY packages/api packages/api
COPY package.json ./

RUN npm run build:api

EXPOSE 8080

CMD [ "node", "packages/api/lib/index.js" ]
12 changes: 0 additions & 12 deletions packages/api/build.js

This file was deleted.

8 changes: 2 additions & 6 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@
],
"private": "true",
"scripts": {
"build": "rm -rf lib && tsc && node build && cp -r ../database lib/database",
"start": "tsc && node lib/index",
"deploy:prod": "npm run build && npm run gceploy:prod",
"deploy:test": "npm run build && npm run gceploy:test",
"gceploy:prod": "gcloud run deploy api --min-instances=3 --memory=1Gi --cpu=1 --concurrency=1000 --allow-unauthenticated --timeout=600 --ingress=internal-and-cloud-load-balancing --region=us-central1 --source=lib",
"gceploy:test": "gcloud run deploy api --allow-unauthenticated --timeout=600 --ingress=internal-and-cloud-load-balancing --region=us-central1 --source=lib"
"build": "tsc",
"start": "tsc && node lib/index"
},
"dependencies": {
"@build-5/database": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getNftMutableMetadata } from './metadataNft/getNftMutableMetadata';
import { getNftMutableMetadataHistory } from './metadataNft/getNftMutableMetadataHistory';
import { sendLiveUpdates } from './sendLiveUpdates';

const port = process.env.PORT || 3000;
const port = 8080;
const app = express();

app.use(cors());
Expand Down

0 comments on commit bb359ec

Please sign in to comment.