I’m relatively new to rails/docker. I’m using a docker container to maintain my development environment, and working on several projects under /apps. In my dockerfile I’ve defined the BUNDLE_PATH and BUNDLE_BIN directories (ubuntu base image):
ENV BUNDLE_PATH=/bundle ENV BUNDLE_BIN=/bundle/bin
I am then using a volume to store the bundle files, and a bind mount so that I can use sublime text to work on the application. I’m using a docker-compose file to accomplish this.
version: '3' services: rails_app: container_name: rails_app command: bash working_dir: /apps environment: RAILS_LOG_TO_STDOUT: 'true' RAILS_ENV: development build: context: . dockerfile: dockerfile_ubuntu volumes: - ./apps:/apps/ - bundle_gems:/bundle ports: - 3000:3000 - 80:80 volumes: bundle_gems:
docker-compose run --service-ports rails_app bash
to bring up my container. I understand eventually I can use entrypoints/scripts to launch my applications.
I’ve noticed that when I work on multiple projects under /apps that the BUNDLE_GEMFILE value does not change as I move from project to project. Shouldn’t bundler know which gemfile to use based on which directory I am executing from? Or do I need to manually adjust BUNDLE_GEMFILE each time I switch projects? Thanks!