Running Next.js app inside Docker container doesn't link any CSS files
Answered
seamus4ever posted this in #help-forum
Hello! I'm doing a beginners course on Next.js and one of the topics is teaching how to run the app inside a docker container. I managed to set up the image and run the container and everything works fine except that there are no CSS styles in my app. I inspected the document and noticed there aren't any stylesheet links in it. I'm not exactly sure how to debug this.
Here's a screenshot of the contents of my Dockerfile, and here's the link of the project's repository if anyone wants to check it out.
https://github.com/j-millan/nextjs-first-steps
Here's a screenshot of the contents of my Dockerfile, and here's the link of the project's repository if anyone wants to check it out.
https://github.com/j-millan/nextjs-first-steps
7 Replies
COPY . .
Answer
@gin hey i think its because u didnt copy the nest folders aswell
Hey, thanks! That actually worked. The guy in the course used
/
instead of .
for the target directory. What's the difference between using the two?@seamus4ever Hey, thanks! That actually worked. The guy in the course used `/` instead of `.` for the target directory. What's the difference between using the two?
if u use / u need to specify the absolute path
but that doesnt matter
in your case u set the workdir in /app but copied the files into /
if u use . . it will choose the relative path based on your workdir