diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..df87aaf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +dist +rush-character-archive/node_modules +vault/node_modules +vault/src/proto \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 747f184..e7645ea 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,7 +3,9 @@ networks: services: rush-character-archive: - build: ./rush-character-archive + build: + context: ./ + dockerfile: ./rush-character-archive/Dockerfile command: npm run dev networks: - rush-character-net @@ -21,7 +23,9 @@ services: - action: rebuild path: ./rush-character-archive/Dockerfile vault: - build: ./vault + build: + context: ./ + dockerfile: ./vault/Dockerfile command: npm run dev networks: - rush-character-net diff --git a/rush-character-archive/Dockerfile b/rush-character-archive/Dockerfile index 87498c4..2c705e5 100644 --- a/rush-character-archive/Dockerfile +++ b/rush-character-archive/Dockerfile @@ -2,13 +2,13 @@ FROM node:22.16 WORKDIR /srv/rush-character-archive -COPY package.json . +COPY rush-character-archive/package.json . RUN npm install RUN npm i -g serve -COPY . . +COPY rush-character-archive/. . RUN npm run build diff --git a/vault/Dockerfile b/vault/Dockerfile index 14fd474..d1eab77 100644 --- a/vault/Dockerfile +++ b/vault/Dockerfile @@ -13,7 +13,6 @@ RUN npm install COPY vault . RUN npm install -g protoc -RUN npm install -g protoc-gen-js RUN npm install -g protoc-gen-ts RUN npm run build diff --git a/vault/package.json b/vault/package.json index c5a0044..ae0a0d2 100644 --- a/vault/package.json +++ b/vault/package.json @@ -4,10 +4,10 @@ "description": "backend for rush cahracter archive", "main": "index.js", "scripts": { - "build_protos": "mkdir src/proto & npx protoc -I=../proto --ts_out=src/proto ../proto/*", - "build": "mkdir src/proto & npx protoc -I=../proto --ts_out=src/proto ../proto/* & tsc", - "start": "mkdir src/proto & npx protoc -I=../proto --ts_out=src/proto ../proto/* & tsc && node dist/app.js", - "dev": "mkdir src/proto & npx protoc -I=../proto --ts_out=src/proto ../proto/* & npx ts-node-dev src/app.ts", + "build_protos": "mkdir -p src/proto & npx protoc -I=../proto --ts_out=src/proto ../proto/*", + "build": "mkdir -p src/proto & npx protoc -I=../proto --ts_out=src/proto ../proto/* & tsc", + "start": "mkdir -p src/proto & npx protoc -I=../proto --ts_out=src/proto ../proto/* & tsc && node dist/app.js", + "dev": "mkdir -p src/proto & npx protoc -I=../proto --ts_out=src/proto ../proto/* & npx ts-node-dev src/app.ts", "test": "echo \"Error: no test specified\" && exit 1", "format": "npx prettier . --write", "lint": "npx eslint . --ext .ts" diff --git a/vault/src/app.ts b/vault/src/app.ts index 1793178..2a7e41f 100644 --- a/vault/src/app.ts +++ b/vault/src/app.ts @@ -1,7 +1,5 @@ -// import express from 'express' import * as grpc from '@grpc/grpc-js' -// import { Character } from './proto/character' import { initCharacterService } from './character_service' const port = 8000; @@ -12,15 +10,4 @@ initCharacterService(app) app.bindAsync("0.0.0.0:8000", grpc.ServerCredentials.createInsecure(), () => { console.log("Starting server at 0.0.0.0:8000") -}) - -// const app = express() - -// app.get('/api/person', async (req, res) => { -// res.status(200).send('potato!') -// }) - -// app.listen(port, async () => { -// console.log(`Express is listening at http://localhost:${port}`) -// return -// }) +}) \ No newline at end of file diff --git a/vault/src/character_service.ts b/vault/src/character_service.ts index 4fe588c..f34fa0b 100644 --- a/vault/src/character_service.ts +++ b/vault/src/character_service.ts @@ -1,7 +1,10 @@ import * as grpc from '@grpc/grpc-js' -import { Character } from './proto/character' +import { Character, GetCharacterRequest, GetCharacterResponse } from './proto/character' export function initCharacterService(server: grpc.Server) { +} +function getCharacter(request: GetCharacterRequest): GetCharacterResponse { + return new GetCharacterResponse() } \ No newline at end of file