Created
March 25, 2017 16:06
-
-
Save rands0n/8e36eab362e190d670f5ecac36016e01 to your computer and use it in GitHub Desktop.
Docker to run ruby
This file contains 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
# set up | |
docker-compose run web rails new . --force --database=postgresql --skip-bundle | |
# db | |
docker-compose run web rails db:create && rails db:migrate | |
# if you have any issues with gems and any time | |
# you change your Gemfile or Dockerfile, run | |
docker-compose build | |
# running the app | |
docker-compose up -d | |
# show the files | |
ls -l | |
# if on linux | |
sudo chown -R $USER:$USER . | |
# config for database | |
username: postgres | |
password: | |
host: db |
This file contains 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: '2' | |
services: | |
db: | |
image: postgres | |
web: | |
build: . | |
command: bundle exec rails -p 3000 -b '0.0.0.0' | |
volumes: | |
- .:/app | |
ports: | |
- "3000:3000" | |
depends_on: | |
- db |
This file contains 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.3.3 | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
RUN mkdir /app # app name | |
WORKDIR /app | |
ADD Gemfile /app/Gemfile | |
ADD Gemfile.lock /app/Gemfile.lock | |
RUN bundle install | |
ADD . /app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment