Giter Site home page Giter Site logo

prelude's Introduction

Prelude

Minimal boiler plate to create a dockerized Ruby on Rails 7 application.

Clone the application

git clone https://github.com/betogrun/prelude.git your_application

# or

git clone [email protected]:betogrun/prelude.git your_application

Change the application name references

Change the application name on Dockerfile

WORKDIR /usr/src/your_application

Change the application name on docker-compose.yml

web:
    build: .
    entrypoint: ./entrypoint-dev.sh
    command: bash -c "bundle exec foreman start -f Procfile.dev -p 3000"
    tty: true
    volumes:
      - .:/usr/src/your_application

Generate the Rails project

Generate an application with Postgres database, esbuild and Tailwind CSS. Feel free to change the options, but keep in mind the next steps may be affected.

docker-compose run --rm --no-deps web bundle exec rails new . --force -d postgresql -j esbuild --css tailwind 
docker-compose run --rm web bundle add foreman --group "development, test"

Change the files ownership if you are using Linux.

sudo chown -R $USER:$USER .

Update the database configuration

Add the following content to config/database.yml default entry.

default: &default
  adapter: postgresql
  encoding: unicode
  host: <%= ENV.fetch("DATABASE_HOST") %>
  username: <%= ENV.fetch("DATABASE_USER") %>
  password: <%= ENV.fetch("DATABASE_PASSWORD") %>
  # For details on connection pooling, see Rails configuration guide
  # https://guides.rubyonrails.org/configuring.html#database-pooling
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

Create the database

docker-compose run --rm web rails db:create

Enable esbuild and Tailwind

Add the following content to package.json

"scripts": {
    "build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds",
    "build:css": "tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify"
  }

Update Procfile.dev

web: bin/rails server -p 3000 -b '0.0.0.0'

Running the application

$ docker-compose up

prelude's People

Contributors

betogrun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.