Skip to content

Commit

Permalink
proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomNick2 committed Oct 19, 2024
1 parent 5233fbd commit 5c6d3b2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
21 changes: 1 addition & 20 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,5 @@ COPY . .
# Генерируем Prisma Client
RUN yarn prisma generate

# Сборка проекта
RUN yarn build

# Stage 2: Запуск приложения
FROM node:lts-alpine

WORKDIR /docker/backend

# Копируем только необходимые файлы для работы приложения
COPY --from=build /docker/backend/dist ./dist
COPY --from=build /docker/backend/package.json ./
COPY --from=build /docker/backend/yarn.lock ./

# Устанавливаем только производственные зависимости
RUN yarn install --production=true

# Открываем порт
EXPOSE 3000

# Запускаем приложение
CMD ["yarn", "start:prod"]
CMD ["yarn", "start:dev"]
1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@prisma/client": "5.21.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"https-proxy-agent": "^7.0.5",
"openai": "^4.68.0",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1"
Expand Down
4 changes: 4 additions & 0 deletions backend/src/quizs/quizs.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { ethers } from 'ethers';
import { HttpsProxyAgent } from 'https-proxy-agent';
import OpenAI from 'openai';
import { PrismaService } from '../prisma/prisma.service';
import type { IGeneratedQuiz } from './aiprompts/generatedQuiz';
Expand All @@ -23,6 +24,9 @@ export class QuizsService {
) {
this.openai = new OpenAI({
apiKey: configService.get('OPENAI_KEY'),
httpAgent: new HttpsProxyAgent(
'http://GXjt8nK3:[email protected]:64270',
),
});

this.provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
Expand Down
17 changes: 16 additions & 1 deletion backend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,13 @@ [email protected]:
resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873"
integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==

agent-base@^7.0.2:
version "7.1.1"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.1.tgz#bdbded7dfb096b751a2a087eeeb9664725b2e317"
integrity sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==
dependencies:
debug "^4.3.4"

agentkeepalive@^4.2.1:
version "4.5.0"
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923"
Expand Down Expand Up @@ -3058,7 +3065,7 @@ [email protected]:
dependencies:
ms "2.0.0"

debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5:
debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5:
version "4.3.7"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
Expand Down Expand Up @@ -4314,6 +4321,14 @@ http-response-object@^3.0.1:
dependencies:
"@types/node" "^10.0.3"

https-proxy-agent@^7.0.5:
version "7.0.5"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz#9e8b5013873299e11fab6fd548405da2d6c602b2"
integrity sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==
dependencies:
agent-base "^7.0.2"
debug "4"

human-signals@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"
Expand Down

0 comments on commit 5c6d3b2

Please sign in to comment.