diff --git a/.dockerignore b/.dockerignore index 81944ea..406ebc0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,3 +4,4 @@ !package.json !package-lock.json !LICENCE +!tsconfig.json diff --git a/Dockerfile b/Dockerfile index aee3676..584f105 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/package.json b/package.json index 4b20fdb..b233f6c 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/index.ts b/src/index.ts index 0825837..96d5d20 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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' }); }