# Ignore everything
**
# Allow files and directories
!/app
!/COPYRIGHT.txt
See also:
- https://codefresh.io/docker-tutorial/not-ignore-dockerignore/
- https://youknowfordevs.com/2018/12/07/getting-control-of-your-dockerignore-files.html
- https://stackoverflow.com/questions/28097064/dockerignore-ignore-everything-except-a-file-and-the-dockerfile
Note: Heroku doesn't support this
# .docker/docker-compose.yml
version: '3.7'
services:
web:
build:
context: ../
dockerfile: .docker/Dockerfile
# .docker/docker-compose.dev.yml
version: '3.7'
services:
web:
build:
context: ../
dockerfile: .docker/web.dev.Dockerfile
cache:
build:
context: ../
dockerfile: .docker/cache.dev.Dockerfile
# .docker/docker-compose.dev.yml
version: '3.7'
services:
web:
build: .
command: 'bash -c "wait-for-it cache:1337 && bin/rails server"'
depends_on:
- cache
volumes:
- cache:/bundle
environment:
BUNDLE_PATH: '/bundle'
cache:
build:
context: ../
dockerfile: .docker/cache.Dockerfile
volumes:
- bundle:/bundle
environment:
BUNDLE_PATH: '/bundle'
ports:
- "1337:1337"
volumes:
cache:
# .docker/cache.Dockerfile
FROM ruby:2.6.3
RUN apt-get update -qq && apt-get install -y netcat-openbsd
COPY Gemfile* ./
COPY .docker/cache-entrypoint.sh ./
RUN chmod +x cache-entrypoint.sh
ENTRYPOINT ./cache-entrypoint.sh
# .docker/cache-entrypoint.sh
#!/bin/bash
bundle check || bundle install
nc -l -k -p 1337
# web.dev.Dockerfile
FROM ruby:2.6.3
RUN apt-get update -qq && apt-get install -y nodejs wait-for-it
WORKDIR ${GITHUB_WORKSPACE:-/app}
# Note: bundle install step removed
COPY . ./