Issue deploying Dockerized Rails app

Hello,
I am new to render and trying to deploy a dockerized rails app, which works locally
The image builds fine and is pushed, but fails when trying to start the server, I get the following error
I feel it is related to not being in the correct directory

#13 [8/8] RUN chmod +x /usr/bin/entrypoint.sh
May 30 04:39:16 PM #13 DONE 0.1s
May 30 04:39:16 PM
May 30 04:39:16 PM #14 exporting to docker image format
May 30 04:39:16 PM #14 exporting layers
May 30 04:39:23 PM #14 exporting layers 6.8s done
May 30 04:39:23 PM #14 exporting manifest sha256:88ac5638085b3767b64b27d59bd896d9ba09c9909e6f6427e9f37798f0f664bb done
May 30 04:39:23 PM #14 exporting config sha256:75c0d3b45f9c09a33845d59fbc7d5d5fd1ccb985fea02573e90a0386174dfc45 done
May 30 04:39:36 PM #14 DONE 20.0s
May 30 04:39:36 PM
May 30 04:39:36 PM #15 exporting content cache
May 30 04:39:36 PM #15 preparing build cache for export
May 30 04:39:47 PM #15 DONE 11.3s
May 30 04:39:47 PM Pushing image to registry…
May 30 04:39:54 PM Upload succeeded
May 30 04:39:54 PM DONE
May 30 04:40:18 PM Usage:
May 30 04:40:18 PM rails new APP_PATH [options]

docker-compose.yml
services:
db:
image: postgres
volumes:
- ./tmp/db:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: password
web:
platform: linux/x86_64
build: .
command: bash -c “rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b ‘0.0.0.0’”
volumes:
- .:/rootly
ports:
- “3000:3000”
depends_on:
- db

Dockerfile
FROM ruby:3.0.0
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client

WORKDIR /rootly
COPY Gemfile /rootly/Gemfile
COPY Gemfile.lock /rootly/Gemfile.lock
RUN bundle install

Add a script to be executed every time the container starts.

COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT [“entrypoint.sh”]
EXPOSE 3000

Configure the main process to run when running the image

CMD [“rails”, “server”, “-b”, “0.0.0.0”]

Entrypoint
#!/bin/bash
set -e

Remove a potentially pre-existing server.pid for Rails.

rm -f /rootly/tmp/pids/server.pid

Then exec the container’s main process (what’s set as CMD in the Dockerfile).

exec “$@”

Hey,

There are a few ways this could fail, if you’re still encountering the issue, please open a support ticket via the “Contact Support” form in the dashboard.

Jérémy.
Render Support, UTC+3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.