Public Repository

Last pushed: 2 months ago
Short Description
Rails API-only application example with MySQL
Full Description

Image is built from the code https://github.com/ec-codecasts/e5-deploy-with-docker-rails-api-single-node , from the screencast tutorial at devteds.com

Here is one - https://devteds.com/episodes/5-deploy-with-docker-single-node-deployment-of-rails-api-application-on-vps

docker-compose.yml sample


version: '2'
services:
  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: railsapp
      MYSQL_USER: appuser
      MYSQL_PASSWORD: password
    ports:
      - "3308:3306" 
  app:
    image: devteds/rails-api-example
    ports:
      - "3003:3000"
    depends_on: 
      - db
    links:
      - db
    environment:         
      DB_USER: root
      DB_NAME: railsapp
      DB_PASSWORD: password
      DB_HOST: db
      #RAILS_ENV: production
      #RAILS_LOG_TO_STDOUT: 1
      #SECRET_KEY_BASE:  <GENERATE ONE USING rails secret>

To run this locally,

mkdir blogapp
cd blogapp
# create docker-compose.yml with the content above
# make any changes and,
docker-compose run --rm app bundle exec rails db:migrate
docker-compose run --rm app bundle exec rails db:seed 
docker-compose up
# curl localhost:3003/posts.json
Docker Pull Command
Owner
devteds