I'am setting up a new dockerfile and docker-compose.yml. I'll below show first my file structure with rails and I want to use a new .dockerignore to ignore node_modules, .git .
my docker version is: Docker version 18.09.0, build 4d60db4
my docker-compose.yml than I use is v3
Root Directory
- Gemfile
- app
- bin
- cable
- db
- config
- lib
- node_modules
- public
- vendor
- docker
- app
- Dockerfile
- .git
- .gitignore
- .dockerignore
- docker-compose.yml
docker/app/Dockerfile
FROM ruby:2.3.1
ARG RAILS_ROOT
RUN mkdir -p $RAILS_ROOT
WORKDIR $RAILS_ROOT
COPY . .
docker-compose.yml
version: '3'
services:
app:
build: &build_core
context: .
dockerfile: ./docker/app/Dockerfile
args:
- APP_NAME=myappname
- RAILS_ROOT=/var/www/${APP_NAME}_web
- RAILS_ENV=development
- RAILS_SERVE_STATIC_FILES=true
- RAILS_LOG_TO_STDOUT=true
- BUNDLE_OPTIONS=
- NPM_OPTIONS=
image: custom-web:1.0
container_name: app
volumes:
- .:/var/www/${APP_NAME}_web
env_file:
- .env
environment:
RAILS_ROOT: "/var/www/${APP_NAME}_web"
.dockerignore
.git/
node_modules/
I built my image with the next command
docker-compose build app
When I look at the container, the file files are still copying to my container
maybe is the context or where I should put my .dockerignore also I put my .dockerignore into docker/app/.dockerignore and I have the same problem.