I'm working on a NestJS project and copying my assets works fine on my Mac. However, once I dockerize it it won't work.
nest-cli.json
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"assets": [
"**/*.hbs",
"**/*.css",
"**/*.jpg",
"**/*.png",
"**/*.jpeg"
],
"watchAssets": true
}
}
Dockerfile:
FROM mhart/alpine-node:latest
RUN npm install pm2 -g
COPY backend /var/www/backend
COPY process.json /var/www
WORKDIR /var/www
#RUN npm i -g @nestjs/cli (tried with and w/out -> no difference)
RUN cd ./backend && npm i --legacy-peer-deps && npm run build
# Expose ports
EXPOSE 80
CMD ["pm2-runtime", "./backend/main"]
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
}
}
tsconfig.build.json
npm{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}
I'm not getting any build errors and I've reproduced these steps manually on my mac and everything's being copied. When I go into the docker image and also run the buld step manually it works with no errors but again, no assets are being copied.
I have my assets in different module & services folders and will want to keep it this way - so I'm not looking for a simply post build copy dir solution :)
I've tried different linux dists. and Node version - I'm not sure what else to check