mirror of
https://github.com/wasnertobias/StalkingAId.git
synced 2025-10-16 11:55:43 +00:00
Add docker files
This commit is contained in:
parent
78fe881d16
commit
8bcbaeb890
13
backend/Dockerfile
Normal file
13
backend/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM node:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm install
|
||||
RUN npm ci --only=production
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8080
|
||||
CMD [ "node", "node.js" ]
|
||||
@ -1,5 +1,5 @@
|
||||
const express = require('express');
|
||||
const https = require('https');
|
||||
const http = require('http');
|
||||
const fs = require("fs");
|
||||
const cors = require("cors");
|
||||
bodyParser = require('body-parser');
|
||||
@ -21,14 +21,10 @@ app.route("/chat").post((req, res) => {
|
||||
getResponse(history, msg, res);
|
||||
});
|
||||
|
||||
https
|
||||
.createServer({
|
||||
key: fs.readFileSync("/etc/letsencrypt/live/stalkingaid.org/privkey.pem", "utf8"),
|
||||
cert: fs.readFileSync("/etc/letsencrypt/live/stalkingaid.org/cert.pem", "utf8"),
|
||||
ca: fs.readFileSync("/etc/letsencrypt/live/stalkingaid.org/chain.pem", "utf8"),
|
||||
}, app)
|
||||
.listen(8543, ()=>{
|
||||
console.log('server is runing at port 8543')
|
||||
http
|
||||
.createServer(app)
|
||||
.listen(8080, ()=>{
|
||||
console.log('server is runing at port 8080')
|
||||
});
|
||||
|
||||
async function getResponse(history, msg, res) {
|
||||
@ -82,4 +78,4 @@ async function getResponse(history, msg, res) {
|
||||
console.error(error.response.status, error.response.data);
|
||||
res.status(error.response.status).json(error.response.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
docker-compose.yml
Normal file
18
docker-compose.yml
Normal file
@ -0,0 +1,18 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
frontend:
|
||||
container_name: "frontend"
|
||||
build:
|
||||
context: ./frontend
|
||||
ports:
|
||||
- 25543:5173
|
||||
|
||||
backend:
|
||||
container_name: "backend"
|
||||
environment:
|
||||
- OPEN_AI_API_KEY=
|
||||
build:
|
||||
context: ./backend
|
||||
ports:
|
||||
- 25544:8080
|
||||
1
frontend/.dockerignore
Normal file
1
frontend/.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
||||
25
frontend/Dockerfile
Normal file
25
frontend/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
FROM node:latest AS base
|
||||
|
||||
RUN npm i -g pnpm
|
||||
|
||||
FROM base AS dependencies
|
||||
|
||||
WORKDIR /app
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install
|
||||
|
||||
FROM base AS build
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
COPY --from=dependencies /app/node_modules ./node_modules
|
||||
RUN pnpm build
|
||||
RUN pnpm prune --prod
|
||||
|
||||
FROM base AS deploy
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=dependencies /app/package.json ./
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
|
||||
CMD [ "pnpm", "preview" ]
|
||||
@ -25,8 +25,7 @@
|
||||
"svelte": "^3.54.0",
|
||||
"svelte-check": "^2.9.2",
|
||||
"tslib": "^2.4.1",
|
||||
"typescript": "^4.9.3",
|
||||
"vite": "^4.0.0"
|
||||
"typescript": "^4.9.3"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
@ -35,6 +34,7 @@
|
||||
"open-props": "^1.5.3",
|
||||
"postcss": "^8.4.21",
|
||||
"postcss-jit-props": "^1.0.9",
|
||||
"sass": "^1.57.1"
|
||||
"sass": "^1.57.1",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user