Builds

What is a build?

A build creates a Docker container image from your application code. You can use builds to create production images that are then deployed to your infrastructure.

Setting up a build

To set up a build, create a Dockerfile at .saturnci/builds/<build-name>/Dockerfile in your repository. The build name can be anything you like, e.g. production.

Example

Here's an example .saturnci/builds/production/Dockerfile for a Rails application:

FROM ruby:3.3.0-slim

RUN apt-get update -qq \
    && apt-get install -y build-essential libpq-dev libyaml-dev \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY Gemfile Gemfile.lock ./
RUN bundle config set without 'development test' \
    && bundle install --jobs 4 --retry 3

COPY . .

ENV RAILS_ENV production
ENV SECRET_KEY_BASE dummy_secret_key_base

RUN bundle exec rails assets:precompile

EXPOSE 3000
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]

Commit this file and push it to your repository. You can then trigger a build using the SaturnCI SDK.