【发布时间】:2021-12-14 04:53:33
【问题描述】:
您好,我对 typem ormconfig 有疑问 我有一个包含以下内容的 dockerfile 设置:
#building code
FROM node as builder
WORKDIR usr/app
COPY package*.json ./
RUN yarn install
COPY . .
RUN yarn run build
#stage 2
FROM node
WORKDIR usr/app
COPY package*.json ./
RUN yarn install --production
COPY --from=builder /usr/app/dist ./dist
COPY ormconfig.json .
COPY .env .
expose 4000
CMD node dist/src/index.js
我的 orm 配置是这样的:
{
"type": "postgres",
"host": "db",
"port": 5432,
"username": "spirit",
"password": "emasa",
"database": "emasa_base",
"synchronize": true,
"logging": false,
"entities": ["src/entity/**/*.ts"],
"migrations": ["src/migration/**/*.ts"],
"subscribers": ["src/subscriber/**/*.ts"],
"cli": {
"entitiesDir": "src/entity",
"migrationsDir": "src/migration",
"subscribersDir": "src/subscriber"
}
}
但是由于我使用打字稿并使用 docker 来运行我的节点,我怀疑我应该放入什么:
"entities": ["src / entity / ** / *. ts"],
"migrations": ["src / migration / ** / *. ts"],
"subscribers": ["src / subscriber / ** / *. ts"]
src 还是 dist?
目前src在启动服务器时没有在数据库中创建我的表我不知道为什么
【问题讨论】:
标签: typescript typeorm