Rails example application built and run on docker
619
Image was built using the application created in devteds Episode 1: Rails on Docker
Please note this image or application dockerization is not production ready. One will need to make a few changes (some are listed below) to make it production ready
version: '3'
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: noteapp
MYSQL_USER: appuser
MYSQL_PASSWORD: password
app:
image: devteds/rails-sample-app:latest
ports:
- "3002:3000"
depends_on:
- db
environment:
DB_USER: root
DB_NAME: noteapp
DB_PASSWORD: password
DB_HOST: db
RAILS_ENV: production
RAILS_SERVE_STATIC_FILES: 1
SECRET_KEY_BASE: ed4988f0afd486feea2528004c8c8e45c0b483f5c3fb21e45ee4e6963fa7f51b2e303d36411135bac36b177fe19db6c3a59b1f0fce22b5a832c5fa694b6554c0
If you create and name the docker compose YAML file as dc-stage.yml with the above content,
docker-compose -f dc-stage.yml up
# and on a seperate terminal
docker-compose -f dc-stage.yml exec app rails db:migrate
docker-compose -f dc-stage.yml exec app rails db:seed
Before executing the above commands, review dc-stage.yml and edit to update host port if needed. Application should be available at http://localhost:3002/notes
Content type
Image
Digest
Size
317.9 MB
Last updated
almost 9 years ago
docker pull devteds/rails-sample-app