I have the following Dockerfile:
FROM node:latest
WORKDIR /usr/src/app
ENV NODE_ENV=production
COPY package*.json .
RUN npm install && npm i -g typescript
COPY . .
RUN tsc
CMD [ "node", "./dist/index.js" ]
And the following package.json:
"dependencies": {
"discord.js": "^12.5.3",
"moment": "^2.29.1"
},
"devDependencies": {
"@types/node": "^14.14.37",
"typescript": "^4.2.4"
}
When I try to build the image, I get the following error:
Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`
Does anyone know why that happens? I have @types/node installed.
index.tsisconst API_KEY = process.env.API_KEY;. Otherwise, it's a standard discord bot. Also a note - it compiles perfectly fine when using tsc on my system AND on an unrelated fresh install of Ubuntu 18.04.devDependencieswon't be installed for production mode