Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion run/helloworld/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# Use the official lightweight Ruby image.
# https://hub.docker.com/_/ruby
FROM ruby:2.7-slim
FROM ruby:2.5-slim

# Install production dependencies.
WORKDIR /usr/src/app
Expand Down
2 changes: 1 addition & 1 deletion run/helloworld/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ DEPENDENCIES
sinatra (~> 2.0)

BUNDLED WITH
2.1.4
1.17.3
11 changes: 8 additions & 3 deletions run/helloworld/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ docker run --rm -p 9090:8080 -e PORT=8080 helloworld:ruby

## Test

```
```sh
# Set an environment variable with your GCP Project ID
export GOOGLE_CLOUD_PROJECT=<PROJECT_ID>

# Install dependencies
bundle install

# Run tests
bundle exec rspec
```

Expand All @@ -46,8 +52,7 @@ export GOOGLE_CLOUD_PROJECT=<PROJECT_ID>
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/helloworld

# Deploy to Cloud Run
gcloud run deploy helloworld \
--image gcr.io/${GOOGLE_CLOUD_PROJECT}/helloworld
gcloud run deploy helloworld --image gcr.io/${GOOGLE_CLOUD_PROJECT}/helloworld
```

Visit your deployed container by opening the service URL in a web browser.
3 changes: 3 additions & 0 deletions run/helloworld/spec/e2e_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

describe "E2E tests" do
before (:all) do
if !ENV["GOOGLE_CLOUD_PROJECT"]
raise "GOOGLE_CLOUD_PROJECT env var not found."
end
suffix = SecureRandom.hex(15)
system("gcloud",
"builds",
Expand Down