Last active
April 13, 2017 17:07
-
-
Save Maysora/06a5dfbecfbb42e8d37acdcdf475ee42 to your computer and use it in GitHub Desktop.
Rails docker
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: | |
db: | |
image: postgres:latest | |
ports: | |
- "5432" | |
environment: | |
POSTGRES_PASSWORD: whatever | |
web: | |
build: . | |
volumes: | |
- .:/my_app | |
depends_on: | |
- db | |
links: | |
- db | |
environment: | |
RACK_ENV: development | |
RAILS_ENV: development | |
DB_HOST: db | |
DB_USERNAME: postgres | |
DB_PASSWORD: whatever | |
command: bundle exec rails s -p 3000 -b '0.0.0.0' | |
ports: | |
- "3000:3000" |
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.1 | |
RUN apt-get update -qq && apt-get install -y build-essential | |
# install nodejs : https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions | |
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - && apt-get install -y nodejs | |
# for postgresql | |
RUN apt-get install -y libpq-dev | |
# set env, encoding change might be necessary for some projects | |
ENV LANG C.UTF-8 | |
ENV LC_ALL C.UTF-8 | |
ENV LANGUAGE C.UTF-8 | |
# create app directory | |
ENV APP_HOME /my_app | |
RUN mkdir $APP_HOME | |
WORKDIR $APP_HOME | |
# bundle install | |
ADD Gemfile* $APP_HOME/ | |
RUN bundle install | |
# add required local files (example npm modules) | |
ADD package.json $APP_HOME/ | |
RUN npm install | |
VOLUME $APP_HOME/node_modules | |
ADD . $APP_HOME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment