This article is about Codeship Pro.


You'll need roughly 3 minutes to read this article.

We’ve got quickstart repos, sample apps and a getting started guide available to make starting out with Codeship Pro faster and easier.

Elixir on Codeship Pro

Any Elixir framework or tool that can run inside a Docker container will run on Codeship Pro. This documentation article will highlight simple configuration files for a Elixir-based Dockerfile with ExUnit tests.

Example Repo

We have a sample Phoenix project that you can clone or take a look at via the GitHub Phoenix Quickstart with Codeship Pro repository. This may make a good starting point for your Phoenix or Elixir-based projects.

Services File

The following is an example of a Codeship Services file. Note that it is using a PostgreSQL image and a Redis image via the Docker Hub as linked services.

When accessing other running containers, please be aware that those services do not run on localhost, but on a different host, e.g. postgres or mysql. If you reference localhost in any of your configuration files you will have to change that to point to the service name of the service you want to access. Setting them through environment variables and using those inside of your configuration files is the cleanest approach to setting up your build environment.

    image: organisation_name/project_name
    dockerfile: Dockerfile
    - redis
    - postgres
    - MIX_ENV=test
    - DATABASE_URL=postgres://postgres@postgres/YOUR_DATABASE_NAME
    - REDIS_URL=redis://redis
  image: healthcheck/redis:alpine
  image: healthcheck/postgres:alpine

Note that in this example we are using the healthcheck version of our Redis and PostgreSQL images to avoid startup timing issues.

Steps File

The following is an example of a Codeship Steps file.

Note that every step runs in isolated containers, so changes made on one step do not persist to the next step. Because of this, any required setup commands, such as migrating a database, should be done via a custom Dockerfile, via a command or entrypoint on a service or repeated on every step.

- name: ci
  type: parallel
  - name: features
    service: project_name
    command: script/ci features
  - name: specs
    service: project_name
    command: script/ci specs
  - name: brakeman
    service: project_name
    command: script/ci brakeman
  - name: seeds
    service: project_name
    command: script/ci seed


Following is an example Dockerfile with inline comments describing each step in the file. The Dockerfile shows the different ways you can install extensions or dependencies so you can extend it to fit exactly what you need. Also take a look at the Elixir image documentation on the Docker Hub.

# We're using the Elixir 1.5.2 base image and extending it
FROM elixir:1.5.2

# Create a directory for your application code and set it as the WORKDIR. All following commands will be run in this directory.
RUN mkdir /app

# COPY mix.exs and mix.lock and install dependencies before adding the full code so the cache only
# gets invalidated when dependencies are changed
COPY app/mix.exs app/mix.lock ./
RUN mix deps.get

# Copy the app source code into the image
COPY . ./

Notes And Known Issues

Because of version and test dependency issues, it is advised to try using the Jet CLI to debug issues locally via jet steps.


You can enable caching per service in your Services file.

You can read more about how caching works on Codeship Pro here.