Created
May 4, 2020 18:48
-
-
Save mdoyle13/46569c3f6fcc15a7205a83f53619af4c to your computer and use it in GitHub Desktop.
Rails 6, ruby 2.7 Docker for Development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3' | |
| services: | |
| redis: | |
| image: redis | |
| db: | |
| image: postgres | |
| ports: | |
| - 5432 | |
| volumes: | |
| - ./postgres-data:/var/lib/postgresql/data:rw | |
| environment: | |
| POSTGRES_USER: root | |
| POSTGRES_PASSWORD: mysecretpassword | |
| web: | |
| build: . | |
| command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" | |
| volumes: | |
| - .:/app | |
| - ./bundle-path:/bundle | |
| ports: | |
| - "3000:3000" | |
| depends_on: | |
| - db | |
| - redis | |
| environment: | |
| REDIS_URL: redis://redis:6379/12 | |
| BUNDLE_PATH: /bundle/vendor | |
| EDITOR: vi #for credentials editing | |
| WEBPACKER_DEV_SERVER_HOST: webpacker | |
| sidekiq: | |
| build: . | |
| command: bundle exec sidekiq | |
| environment: | |
| REDIS_URL: redis://redis:6379/12 | |
| BUNDLE_PATH: /bundle/vendor | |
| depends_on: | |
| - db | |
| - redis | |
| volumes: | |
| - .:/app | |
| - ./bundle-path:/bundle | |
| webpacker: | |
| build: . | |
| environment: | |
| - NODE_ENV=development | |
| - RAILS_ENV=development | |
| - WEBPACKER_DEV_SERVER_HOST=0.0.0.0 | |
| command: ./bin/webpack-dev-server | |
| volumes: | |
| - .:/app | |
| ports: | |
| - '3035:3035' | |
| volumes: | |
| bundle-path: | |
| postgres-data: | |
| # redis data doesn't need to persist right now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ruby:2.7 | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| build-essential \ | |
| libpq-dev &&\ | |
| curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ | |
| curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | |
| echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ | |
| apt-get update && apt-get install -y nodejs yarn vim | |
| RUN mkdir /app | |
| WORKDIR /app | |
| COPY Gemfile /app/Gemfile | |
| COPY Gemfile.lock /app/Gemfile.lock | |
| COPY package.json /app/package.json | |
| COPY yarn.lock /app/yarn.lock | |
| RUN bundle install | |
| RUN yarn install --check-files | |
| COPY . /app | |
| # Add a script to be executed every time the container starts. | |
| #COPY entrypoint.sh /usr/bin/ | |
| #RUN chmod +x /usr/bin/entrypoint.sh | |
| #ENTRYPOINT ["entrypoint.sh"] | |
| EXPOSE 3000 | |
| # Start the main process. | |
| CMD ["rails", "server", "-b", "0.0.0.0"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment