Skip to content

Instantly share code, notes, and snippets.

@hieu-v
Created December 10, 2022 15:38
Show Gist options
  • Save hieu-v/23dad04d4a566c926ccb7ca0518ac21e to your computer and use it in GitHub Desktop.
Save hieu-v/23dad04d4a566c926ccb7ca0518ac21e to your computer and use it in GitHub Desktop.
version: '3'

services:
  app:
    build:
      context: .
    tty: true
    stdin_open: true
    ports:
      - "3000:3000"
    depends_on:
      - db
    volumes:
      - .:/app
    command: "bundle exec rails s -p 3000 -b '0.0.0.0'"

  db:
    image: postgres:15-alpine
    ports:
      - "5432:5432"
    environment:
      POSTGRES_HOST_AUTH_METHOD: 'trust'
    volumes:
      - db:/var/lib/postgresql/data

volumes:
  db:
    driver: local
FROM ruby:3.1.3-alpine

RUN apk add --no-cache \
    build-base \
    gcompat \
    postgresql-dev \
    git \
    nodejs \
    yarn \
    tzdata \
    vim \
    curl

WORKDIR /app

COPY Gemfile* /app/
RUN bundle config --local frozen 1 && \
    bundle install -j4 --retry 3

ENTRYPOINT ["docker/startup.sh"]
#! /bin/sh

bundle exec rails db:create && bundle exec rails db:migrate

exec "$@"
@hieu-v
Copy link
Author

hieu-v commented Dec 10, 2022

rails new your_app --database=postgresql --css tailwind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment