Open Nazar-Brunarskyi opened 6 months ago
here is my project.json file
{
"name": "web",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/web",
"projectType": "application",
"tags": ["scope:web"],
"targets": {
"build": {
"executor": "@nx/next:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/apps/web"
},
"configurations": {
"development": {
"outputPath": "apps/web"
},
"production": {},
"qa": {}
}
},
"serve": {
"executor": "@nx/next:server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "apps/web:build",
"dev": true,
"port": 4200
},
"configurations": {
"development": {
"buildTarget": "web:build:development",
"dev": true
},
"production": {
"buildTarget": "web:build:production",
"dev": false
},
"qa": {
"buildTarget": "web:build:qa",
"dev": false
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/web/**/*.{ts,tsx,js,jsx}"]
}
}
}
}
Not sure if you're still running into this problem, but I was just having the same issue. We spent a while debugging, and what fixed it in the end was adding thedist
and .nx
(cache) folders (in the monorepo root) to our .dockerignore
file.
We also had to exclude the package-lock.json
file from the Dockerfile
but that could be some other issue in my environment not-specific to this. I haven't tried regenerating the package-lock.json
file to see if that fixes it, we're just excluding it for now.
The hypothesis we've got on my team is that something in nx
is crawling all the directories and stopping when it hits the dist
and/or .nx
folder(s) for some reason.
Current Behavior
I want to Dockerize my next js app for this I have created a docker file:
to build an image i use
$ docker build -f Dockerfile.web -t web .
command.The Image is built successfully.
when I try to run a container from that image i get an error:
Expected Behavior
I expect the container to start successfully and I would be able to open the app inside browser
GitHub Repo
No response
Steps to Reproduce
WORKDIR /usr/src/apps
COPY package*.json ./ RUN npm install
COPY . .
EXPOSE 4200
CMD ["npm", "run", "web:serve:qa"]
Failure Logs
Package Manager Version
9.8.1
Operating System
Additional Information
No response