Add dockerfile and compose file for build

This commit is contained in:
GooeyTuxedo 2023-04-05 19:22:51 -07:00
parent f48c36f9c3
commit 6edd6ec2cc
3 changed files with 32 additions and 1 deletions

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM node:18-slim as ts-compiler
WORKDIR /usr/app
COPY yarn.lock ./
COPY package*.json ./
COPY tsconfig*.json ./
RUN yarn install --frozen-lockfile
COPY . ./
RUN yarn run build
FROM node:18-slim as ts-remover
WORKDIR /usr/app
COPY --from=ts-compiler /usr/app/yarn.lock ./
COPY --from=ts-compiler /usr/app/package*.json ./
COPY --from=ts-compiler /usr/app/dist ./
ENV NODE_ENV=production
RUN yarn install --frozen-lockfile
FROM node:18-slim
WORKDIR /usr/app
COPY --from=ts-remover /usr/app ./
CMD node index.js

10
docker-compose.yml Normal file
View File

@ -0,0 +1,10 @@
version: '3'
services:
openai-discord:
build: .
container_name: openai-discord
working_dir: /usr/app
environment:
- DISCORD_API_KEY
- OPENAI_API_KEY
restart: unless-stopped

View File

@ -19,7 +19,6 @@
"@types/node": "^18.15.0",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"dotenv": "^16.0.3",
"eslint": "^8.33.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
@ -31,6 +30,7 @@
},
"dependencies": {
"discord.js": "^14.7.1",
"dotenv": "^16.0.3",
"openai": "^3.2.1",
"winston": "^3.8.2"
}