-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work for me :( I still get a seg fault because its trying to run mac modules in a linux container. Check out what I wrote on slack for how to fix this.
docker-compose.yml
Outdated
command: yarn run dev | ||
working_dir: /usr/src/nuxt-app | ||
volumes: | ||
- .\:/usr/src/nuxt-app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.\
doesn't work on unix machines, like macs, use just .
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wish I could join u guys for dinner instead of doing hwk and stuff ;(
Dockerfile
Outdated
WORKDIR /usr/src/nuxt-app | ||
COPY package*.json yarn.lock ./ | ||
RUN yarn install | ||
RUN npm rebuild node-sass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't need to happen if the modules are installed for linux already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you referring to the npm rebuild node-sass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sass/node-sass#2536 I was getting some error highly related with this. I had to use npm rebuild node-sass
to fix it on my computer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes it work because it rebuilds the node modules in your host computers node folder into Linux versions. What we want is tell docker to use the node modules built into the docker image already. I explained on slack how to do this, it’s a pretty simple addition to the volumes field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new volume:
- /usr/src/nuxt-app/node_modules
Under the other volume mount in the docker compose
docker-compose.yml
Outdated
version: '3.7' | ||
services: | ||
nuxt: | ||
image: kozr/lhd2020_nuxt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to be able to rebuild the container in case we add more node modules, we should use build instead of a preset image.
.dockerignore
Outdated
@@ -0,0 +1,4 @@ | |||
node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an FYI, dockerignore only affects the building of the image, not the volume mounts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lookin good now!
can you add instructions for using this cuz idk what im supposed to do |
@ianmah Theres some in the Readme, do you think we should add more? |
oops i didn't mean to merge this.. |
please check if it's correct