I'm trying to run dockerfile localy(project on Node TypeScript)
dockerfile
FROM node:20-alpine
EXPOSE 5000
MAINTAINER Some Dev
RUN mkdir /app
WORKDIR /app
COPY ./backend/* /app
RUN npm i
CMD ["npm","start"]
but i have a problem error TS18003: No inputs were found in config file '/app/tsconfig.json'. Specified 'include' paths were '["./src/","./src/**/.ts","./src/.ts"]' and 'exclude' paths were '["./dist"]'.
tsconfig.json
{
"compilerOptions": {
"target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "commonJS", /* Specify what module code is generated. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"rootDir": "./src",/* Specify the root folder within your source files. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"removeComments": true, /* Disable emitting comments. */
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
"skipLibCheck": true
},
"include": [
"./src/",
"./src/**/*.ts",
"./src/*.ts"
],
"exclude": [
"./dist"
]
}
Tried some different thing in include,exclude. Saw advise for add empty ts file and create but nothing change. Restart IDE(IntelliJ idea).
This error happens when there are no .ts files inside the project. This is happening because /src
folder is not being copied to /app
because the * only copies files inside a directory and not subdirectories. Change COPY ./backend/* /app
to COPY ./backend /app
.