I'm trying to build an image for my app,
FROM ruby:2.2.1, my app folder sums up about 200 mb compressed.
I'm receiving a
"Your disk is full" when running
bundle install. It's also takes too much time to create the compressed context. However runing a
/var/ shows more than 1TB available, this however is not what bother me.
My question is, can I ignore everything using an
.dockerignore and then add my root project folder as a volume using docker-compose? does this sounds like a good idea?
I've also think in:
Dockerfileto a subfolder (but I think i'm not able to add a parent folder as volume using docker compose
Note, your question doesn't match your title or first half of your post, I'll answer what you've asked.
My question is, can I ignore everything using an * in .dockerignore and then add my root project folder as a volume using docker-compose? does this sounds like a good idea?
You can add your project with a volume in docker-compose, but you lose much of the portability (your image will be incomplete if anyone else tries to use it without your volume data). You also lose the ability to do any compilation steps and may increase your container startup time as it pulls in dependencies. Lastly, if you run out of space on build, there's a good chance you'll run out of space on a run unless your volume data is a significant portion of your container size.
If I ignore a file on .dockerignore can I use COPY on that file from Dockerfile?
No, you can't use COPY or ADD on any file that's excluded in the push to the docker daemon via .dockerignore.