Skip to content

Instantly share code, notes, and snippets.

@TETRA2000
Forked from nassy274/.dockerignore
Last active February 15, 2017 17:54
Show Gist options
  • Save TETRA2000/884e2f6ee3cfa63b3159d6e8d0a7d955 to your computer and use it in GitHub Desktop.
Save TETRA2000/884e2f6ee3cfa63b3159d6e8d0a7d955 to your computer and use it in GitHub Desktop.
Ruby on Rails on Docker
.bundle
tmp
vendor/bundle
version: '2'
services:
app:
build: .
expose:
- "3000"
ports:
- "3000:3000"
environment:
- RAILS_ENV=development
volumes:
- .:/opt/app
links:
- db
db:
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
image: "mariadb:10.1.2"
expose:
- "3306"
environment:
- MYSQL_ROOT_PASSWORD=password
FROM ruby:2.3
## Optional
# RUN apt-get update
# RUN apt-get install -y nodejs npm
ADD . /opt/app
WORKDIR /opt/app
RUN mkdir /home/app
RUN bundle install
RUN useradd app
RUN chown app /home/app
USER app
EXPOSE 3000
ENTRYPOINT bundle exec rake db:create db:migrate db:seed
CMD rm /opt/app/tmp/pids/server.pid; bin/rails s -b 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment