ts: support docker image

This commit is contained in:
Mylloon 2022-07-20 14:25:03 +02:00
parent 5fa03d8097
commit de32cd4891
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 11 additions and 4 deletions

View file

@ -4,3 +4,4 @@
!package.json
!package-lock.json
!LICENCE
!tsconfig.json

View file

@ -10,4 +10,8 @@ WORKDIR /app
COPY --chown=node:node . .
RUN npm ci --only=production
CMD ["dumb-init", "node", "src/index.js"]
RUN npx tsc
RUN rm -r src/ tsconfig.json
CMD ["dumb-init", "node", "./dist/index.js"]

View file

@ -17,14 +17,14 @@
"dependencies": {
"@discordjs/rest": "^0.5.0",
"discord-api-types": "^0.36.0",
"discord.js": "^13.8.1"
"discord.js": "^13.8.1",
"typescript": "^4.7.4"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"dotenv": "^16.0.1",
"eslint": "^8.20.0",
"ts-node-dev": "^2.0.0",
"typescript": "^4.7.4"
"ts-node-dev": "^2.0.0"
}
}

View file

@ -7,6 +7,8 @@ const run = async () => {
// Load .env if not in prod
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
(await import('dotenv')).config({ path: './config/.env' });
}