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 "$@"