我有一个用打字稿写的快递项目。构建过程在我的正常环境(就像在每个桌面上)上都可以正常工作,但在docker中却不能。如果我尝试在图像中运行tsc
命令,则会引发错误。
error TS18003: No inputs were found in config file '/var/server/tsconfig.json'. Specified 'include' paths were '["lib/**/*.ts"]' and 'exclude' paths were '["node_modules"]'.
文件夹结构
userservice/
├── lib/
├── somefile.ts
├── file.ts
├── otherfile.ts
├── samplefile.ts
└── controller
└── mvcController1.ts
└── mvcController2.ts
├── tsconfig.ts
├── otherfiles
我已经尝试过
include
数组的第一项从"lib/**/*.ts"
更改为"**/*.ts"
我的tsconfig.json文件
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"pretty": true,
"sourceMap": true,
"target": "es6",
"outDir": "./dist",
"baseUrl": "./lib"
},
"include": [
"lib/**/*.ts"
],
"exclude": [
"node_modules"
]
}
FROM mongo-express
# Copying Dist Files to /var/server
COPY ./ /var/server
# Changing workdir to /var/server
WORKDIR /var/server
# Installing Necessary Packages
RUN npm i
RUN npm run lint
RUN npm run build
# Expose Port
EXPOSE 80
# Running in production
ENTRYPOINT [ "node", "./dist/server.js" ]
我希望docker容器以与正常环境中相同的方式运行tsc
命令。而且不希望引发异常。
答案 0 :(得分:0)
哦... lib/
目录是.dockerignore文件的一部分...
很抱歉浪费您的时间。仍然要感谢阅读此问题的每个人!