Skip to content

semaphoreci-demos/semaphore-demo-cloud-run

Repository files navigation

Semaphore CI/CD demo for Google Cloud Run

Build Status

This is an example application and CI/CD pipeline showing how to build, test and deploy a serverless microservice to Google Cloud Run using Semaphore.

Ingredients:

  • Ruby Sinatra as web framework
  • RSpec for tests
  • Packaged in a Docker container
  • Container pushed to Google Container Registry
  • Deployed to Google Cloud Run:
    • One-click deployment to staging
    • Continuous deployment to master on green builds on master branch

CI/CD on Semaphore

If you're new to Semaphore, feel free to fork this repository and use it to create a project.

The CI/CD pipeline is defined in .semaphore directory and looks like this:

CI/CD pipeline on Semaphore

The repository includes a second deployment pipeline for AWS App Runner.

CI/CD pipeline for App Runner

You can follow through the documentation for a complete walkthrough.

Local application setup

To run the microservice:

bundle install
bundle exec rackup

To run tests:

bundle exec rspec

To build and run Docker container:

docker build -t semaphore-demo-ruby-app .
docker run -itd -p 8080:8080 semaphore-demo-ruby-app
curl localhost:8080
> hello world :))

License

Copyright (c) 2021 Rendered Text

Distributed under the MIT License. See the file LICENSE.