There is small config of docker-compose with Dockerfiles and .dockerignore files I have in subdirectories. I can't understand why my images after build include everything even I have some items to ignore in .dockerignore. Here is what I have
docker-compose.yml
docker
├── app
│ ├── Dockerfile
│ └── .dockerignore
└── web
├── Dockerfile
├── nginx.conf
└── .dockerignore
Example of .dockerignore:
**/.dockerignore
docker-compose.yml
log
**/log
../../log
I just run this as follows:
docker-compose up -d --build --no-cache
None of the above ignored.. What am I doing wrong?
docker-compose version 1.23.2, build 1110ad01
Adding Dockerfile for the app service (see docker-compose). Docker-compose packs two images with ROR app and nginx. For both dockerfiles I have dockerignore. So my understanding is that I can say what exactly I want in each. But it is not. How can I ignore some of the files in package? Or should I put my Dockerfile and dockerignore in different paths since build works only inside the context.. I am confused.
FROM ruby:2.4.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs imagemagick
# Configuring main directory
RUN mkdir -p /var/www/example.com
WORKDIR /var/www/example.com
# Setting env up
ENV RAILS_ENV='production'
ENV RACK_ENV='production'
# Adding gems
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
RUN bundle install --jobs 20 --retry 5 --without development test
# Adding project files
COPY . .
EXPOSE 3000
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
So I thought that COPY . . checks .dockerignore first.. no?