We've moved discussions to Discord

Docker Compose Error

Hi Everyone:

I tried the different DockerFiles & Configs available on:
https://jumpstartrails.com/discussions/25 &
https://jumpstartrails.com/discussions/252
But still facing some or the other issue, because of ruby version, rack, Gemfile, ruby-concurrency etc. etc.
Here is one of the things I tried:

Dockerfile
FROM ruby:2.7.1-alpine

RUN apk add --update --virtual \
  runtime-deps \
  postgresql-client \
  build-base \
  libxml2-dev \
  libxslt-dev \
  nodejs \
  yarn \
  libffi-dev \
  readline \
  build-base \
  postgresql-dev \
  libc-dev \
  linux-headers \
  readline-dev \
  file \
  imagemagick \
  git \
  tzdata \
  && rm -rf /var/cache/apk/*

WORKDIR /app
ADD . /app/

ENV BUNDLE_PATH /gems

EXPOSE 3000
CMD ["bundle","yarn", "exec", "rails", "server", "-b", "0.0.0.0"]

docker-compose.yml
version: "3.0"

services:
  web:
    build: 
      context: .
      dockerfile: Dockerfile.dev
    volumes:
      - ./rails:/app
      - ./bundler_gems:/gems
    working_dir: /app
    ports:
      - 3000:3000
    depends_on:
      - db
    environment:
      DATABASE_URL: postgres://postgres@db
    command: bundle exec rails s -p 3000 -b '0.0.0.0'
  db:
    image: mdillon/postgis:11
    ports:
      - 5432:5432
    volumes:
      - ./postgres:/var/lib/postgresql/data
  pgadmin4:
    image: thajeztah/pgadmin4
    ports:
      - 5050:5050
    depends_on:
      - db
volumes:
  postgres:
  bundler_gems:

Run
docker-compose build
docker-compose run --rm web bundle install -j8
docker-compose run --rm web yarn install -j8

With this config, I am getting the error
Could not locate Gemfile or .bundle/ directory

Can you please guide me in the right direction.

Chris Oliver
Does docker-compose run put you into /app when it runs the command? If not, you'll need to cd into the app directory.

I need to add some more docs for Docker, but I don't use it hardly ever.
Notifications
You’re not receiving notifications from this thread.