Created
January 27, 2018 07:18
-
-
Save arkokoley/4867229cc180d49ee25352842cb3cea6 to your computer and use it in GitHub Desktop.
Docker Deployment files for Rails with Solr
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
# Ignore bundler config. | |
/.bundle | |
# Ignore the default SQLite database. | |
/db/*.sqlite | |
/db/*.sqlite-journal | |
# Ignore all logfiles and tempfiles. | |
/log/* | |
/tmp/* | |
!/log/.keep | |
!/tmp/.keep | |
/node_modules | |
/yarn-error.log | |
.byebug_history | |
/public/packs | |
/public/assets | |
/public/packs-test | |
/node_modules | |
/solr |
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
REDIS_URL=redis://redis:6379/ | |
DB_USERNAME=postgres | |
DB_PASSWORD=password | |
RAILS_ENV=production | |
NODE_ENV=production | |
SECRET_KEY_BASE= | |
SMTP_ADDRESS= | |
SMTP_USERNAME= | |
SMTP_PASSWORD= | |
VIRTUAL_HOST= | |
RAILS_SERVE_STATIC_FILES=true |
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
gem: --no-rdoc --no-ri |
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: | |
web: | |
build: . | |
ports: | |
- "3000:3000" | |
dns: "8.8.8.8" | |
volumes: | |
- ".:/app" | |
env_file: .env | |
links: | |
- db:db | |
- solr:solr | |
# In production instead add external_links for db | |
command: bash -c "bin/rake assets:precompile && bin/rake db:create && bin/rake db:migrate && bin/rails s" | |
# In production remove this and add an external link in web | |
db: | |
image: postgres:latest | |
environment: | |
- POSTGRES_PASSWORD=password | |
volumes: | |
- ./database:/var/lib/postgresql | |
solr: | |
image: solr:7.0.1 | |
ports: | |
- "8983:8983" | |
volumes: | |
- data:/opt/solr/server/solr/mycores | |
entrypoint: | |
- docker-entrypoint.sh | |
- solr-precreate | |
- mycore | |
links: | |
- db:db | |
volumes: | |
data: {} |
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.4-alpine | |
RUN apk --update add --virtual\ | |
build-dependencies build-base libev libev-dev postgresql-dev nodejs bash\ | |
tzdata sqlite-dev git curl | |
#RUN apt-get update -qq && apt-get install -y build-essential apt-transport-https apt-utils | |
# for yarn | |
RUN npm install -g yarn | |
WORKDIR /app | |
ADD .gemrc /app | |
ADD Gemfile /app/ | |
ADD Gemfile.lock /app/ | |
ENV RAILS_ENV=development | |
ENV NODE_ENV=development | |
RUN bundle install --jobs 8 | |
ADD package.json /app/ | |
RUN yarn install | |
ADD . /app | |
RUN rake db:create && rake db:migrate | |
EXPOSE 3000 | |
CMD ["bundle", "exec", "rails", "s"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment