I'm new to Cloudrun, attempting to deploy a Sinatra app. I've gone through the documentation, but can't figure out why '--source' keeps getting passed in. Haven't left it in the app itself, I figure it's added in from the deploy command. I've tried many tweaks to the Dockerfile & application config. I'd prefer not to have to install Docker on this machine but dockerizing before deployment could well solve the issue. I'd appreciate suggestions on what else I could try.
Error messages from logs:
1) terminated: Application failed to start: kernel init: cannot resolve init executable: error finding executable "--source" in PATH [/usr/local/bundle/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin]: no such file or directory
2) /usr/local/bundle/gems/sinatra-3.0.6/lib/sinatra/main.rb:22:in `<module:Sinatra>': invalid option: --source (OptionParser::InvalidOption)
$ gcloud run deploy
Deploying from source. To deploy a container use [--image]. See https://cloud.google.com/run/docs/deploying-source-code for more details.
Source code location (/home/bjorn/...):
Next time, use `gcloud run deploy --source .` to deploy the current directory.
# Dockerfile
FROM ruby:3.2.2
WORKDIR /usr/src/app
COPY Gemfile Gemfile.lock ./
ENV BUNDLE_FROZEN=true
ENV BUNDLER_VERSION 2.4.10
RUN gem install bundler && \
bundle config set --local without 'test' && \
bundle install
COPY server.rb config.ru puma.rb ./
EXPOSE 8080
Entrypoint ["ruby", "./server.rb"]
# Alternately:
# CMD ["ruby", "./server.rb"]
# CMD ["bundle", "exec", "rackup", "--host", "0.0.0.0", "-p", "8080"]
# CMD ["web: bundle exec ruby server.rb -p 8080
Per request, more verbose logs:
DEFAULT 2023-08-21T07:45:18.516796Z /usr/local/bundle/gems/sinatra-3.1.0/lib/sinatra/main.rb:22:in `<module:Sinatra>': invalid option: --source (OptionParser::InvalidOption)
DEFAULT 2023-08-21T07:45:18.516820Z from /usr/local/bundle/gems/sinatra-3.1.0/lib/sinatra/main.rb:3:in `<top (required)>'
DEFAULT 2023-08-21T07:45:18.516826Z from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
DEFAULT 2023-08-21T07:45:18.516831Z from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
DEFAULT 2023-08-21T07:45:18.516836Z from /usr/local/bundle/gems/sinatra-3.1.0/lib/sinatra.rb:3:in `<top (required)>'
DEFAULT 2023-08-21T07:45:18.516840Z from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:159:in `require'
DEFAULT 2023-08-21T07:45:18.516845Z from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:159:in `rescue in require'
DEFAULT 2023-08-21T07:45:18.516849Z from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:39:in `require'
DEFAULT 2023-08-21T07:45:18.516854Z from ./server.rb:1:in `<main>'
DEFAULT 2023-08-21T07:45:18.516859Z <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- sinatra (LoadError)
DEFAULT 2023-08-21T07:45:18.516864Z from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
DEFAULT 2023-08-21T07:45:18.516867Z from ./server.rb:1:in `<main>'
WARNING 2023-08-21T07:45:18.579930873Z Container called exit(1).
ERROR 2023-08-21T07:45:18.619506Z [protoPayload.serviceName: run.googleapis.com] [protoPayload.methodName: v1] [protoPayload.resourceName: [xyz] Ready condition status changed to False for Revision xyz with message: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information. Logs URL: https://console.cloud.google.com/logs/viewer?project=etc For more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start