Our new ebook “CI/CD with Docker & Kubernetes” is out. Download it here.

Define your CI/CD environment with Docker

CI/CD for Docker and Kubernetes

The range of applications that you can run on Semaphore keeps growing. After native support for iOS, today we’re happy to announce that you can run your CI/CD in any Docker image. This means that Semaphore now supports any technology stack that works with Docker out of the box.

Docker has become a standard for packaging and deploying cloud applications, APIs and microservices. Semaphore has supported building and running containers via full access to the Docker CLI for a long time. However, we’ve heard loud and clear from developers who wanted to use the same environment in development, CI/CD and production: it should be easier than running raw Docker commands.

Here’s an example how you’d define an agent for a web application:

    type: e1-standard-2

    - name: main
      image: semaphoreci/ruby:2.6.1-node
        - name: DATABASE_URL
          value: "postgres://postgres:keyboard-cat@db"
        - name: RAILS_ENV
          value: test

    - name: db
      image: postgres:10
        - name: POSTGRES_PASSWORD
          value: keyboard-cat

The first container in the containers list is the one which will execute the jobs.

In the example above, we’re using a custom Ruby image built by Semaphore. For your convenience, Semaphore provides a number of pre-built images hosted on Docker Hub that are optimized for CI/CD. Work on new images is public, and we welcome your feedback through the open source docker-images project hosted on GitHub.

Of course, you can run CI/CD jobs in your own Docker images. Semaphore can pull them from both public and private registries.

A real-world project rarely runs in a single Docker container. Semaphore lets you combine multiple containers into a single environment of networked services.

In the example above, the second container is providing PostgreSQL service to the main container and is available via DNS by the hostname db.

Is the new Docker-based environment for you?

Docker-based agents will be a first-class citizen alongside Linux and macOS platforms. For several new technologies which we will soon announce support for, the Docker-based approach will be the way to go.

We will continue to update the Linux and macOS platforms with the selected software stack. Semaphore will not force you to use a Docker image for your existing projects.

However, if your Semaphore configuration includes significant software customization steps, we recommend adopting a Docker-based approach in which you’ll use an image that contains exactly the dependencies that you need, and nothing else.

Get started

To learn more about available options for running Docker-based agents and using them in your projects, refer to Semaphore documentation.

Happy building!

Leave a Reply

Your email address will not be published. Required fields are marked *

Sign up for a weekly Semaphore newsletter