ts: support docker image
This commit is contained in:
parent
5fa03d8097
commit
de32cd4891
4 changed files with 11 additions and 4 deletions
|
@ -4,3 +4,4 @@
|
||||||
!package.json
|
!package.json
|
||||||
!package-lock.json
|
!package-lock.json
|
||||||
!LICENCE
|
!LICENCE
|
||||||
|
!tsconfig.json
|
||||||
|
|
|
@ -10,4 +10,8 @@ WORKDIR /app
|
||||||
COPY --chown=node:node . .
|
COPY --chown=node:node . .
|
||||||
|
|
||||||
RUN npm ci --only=production
|
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"]
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/rest": "^0.5.0",
|
"@discordjs/rest": "^0.5.0",
|
||||||
"discord-api-types": "^0.36.0",
|
"discord-api-types": "^0.36.0",
|
||||||
"discord.js": "^13.8.1"
|
"discord.js": "^13.8.1",
|
||||||
|
"typescript": "^4.7.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
||||||
"@typescript-eslint/parser": "^5.30.7",
|
"@typescript-eslint/parser": "^5.30.7",
|
||||||
"dotenv": "^16.0.1",
|
"dotenv": "^16.0.1",
|
||||||
"eslint": "^8.20.0",
|
"eslint": "^8.20.0",
|
||||||
"ts-node-dev": "^2.0.0",
|
"ts-node-dev": "^2.0.0"
|
||||||
"typescript": "^4.7.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ const run = async () => {
|
||||||
|
|
||||||
// Load .env if not in prod
|
// Load .env if not in prod
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
(await import('dotenv')).config({ path: './config/.env' });
|
(await import('dotenv')).config({ path: './config/.env' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue