---
title: How to use Scaleway Container Registry with GitHub Actions
description: In this tutorial, you will learn to configure and use GitHub Actions to build Docker images and push them into Scaleway Container Registry.
tags: github container-registry yaml
products:
  - container-registry
  - containers
dates:
  validation: 2025-05-06
  posted: 2023-02-27
  validation_frequency: 12
difficulty: beginner
usecase:
  - best-practices
ecosystem:
  - third-party
---
import image from './assets/scaleway-container-registry-settings.webp'
import image2 from './assets/scaleway-github-workflow-trigger.webp'

import Requirements from '@macros/iam/requirements.mdx'


In this tutorial you will learn how to configure and use [GitHub Actions](https://docs.github.com/en/actions) to build a [Docker](https://www.docker.com/) image and push it into [Scaleway Container Registry](https://www.scaleway.com/en/container-registry/).

GitHub Actions is a platform for automating software development workflows in the context of GitHub repositories. It allows you to define and run workflows, which are automated sequences of steps that can be triggered by events such as pushes to the repository, pull requests, or the creation of a new tag.

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- A valid [API key](/iam/how-to/create-api-keys/)
- A private [Container Registry namespace](/container-registry/how-to/create-namespace/)
- A [member role in a GitHub organization](https://docs.github.com/en/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization)
- Created [a GitHub repository](https://docs.github.com/en/get-started/quickstart/create-a-repo) in that organization
- A [working Dockerfile in the root of the repository](https://docs.docker.com/engine/reference/builder/) in that organization

## Setting up your Scaleway secrets in GitHub

For your GitHub Action to interact with your Scaleway Container Registry, it is necessary to provide the required data to your repository. The first step is to store all the necessary information in GitHub secrets.

1. Go to the **Settings** page of your GitHub repository. In the **Secrets and variables** menu, select **Actions**.

2. Create a first secret holding your Scaleway API key.
    Click **New repository secret**. In the "name" field, enter `SCALEWAY_API_KEY`, and paste your API secret key in the "value" field. The access key ID will not be used here.
    <Message type="important">
        Make sure not to leave any leading or trailing spaces in the "value" field.
    </Message>

3. Create a second secret holding your container registry endpoint. You can find your endpoint in your Scaleway Container Registry settings:
    <Lightbox image={image} alt="" />

    Click **New repository secret** again. In the "name" field, enter `CONTAINER_REGISTRY_ENDPOINT`, and paste your endpoint in the "value" field.

## Creating your GitHub Action workflow

Next, we create a GitHub Actions workflow that you can trigger, which is an automated sequence of steps to build and deploy your Docker image.

### Creating the workflow

GitHub workflows are described by [YAML](https://en.wikipedia.org/wiki/YAML) files located in the `.github/workflows` directory of your repository.
In your repository root, create the `.github` folder and the `workflows` sub-folder, then create a file `.github/workflows/build.yml`.

```yml
name: Build & Deploy to Scaleway

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Login to Scaleway Container Registry
      uses: docker/login-action@v3
      with:
        username: nologin
        password: ${{ secrets.SCALEWAY_API_KEY }}
        registry: ${{ secrets.CONTAINER_REGISTRY_ENDPOINT }}
    - name: Build the Docker image
      run: docker build . -t ${{ secrets.CONTAINER_REGISTRY_ENDPOINT }}/my-docker-image
    - name: Push the Docker Image
      run: docker push ${{ secrets.CONTAINER_REGISTRY_ENDPOINT }}/my-docker-image
```

This workflow has one job called **build**, which is set to run on the latest version of Ubuntu. The job includes four steps:

1. `actions/checkout@v4` is used to check out the repository's code.
2. `docker/login-action@v3` is used to authenticate with the Scaleway Container Registry. The action uses the API key and container registry endpoint stored in GitHub secrets.
3. `docker build` is used to build a Docker image with the code from the repository. The resulting image is tagged with the container registry endpoint and the name of the image, which is `my-docker-image` in this case.
4. `docker push` is used to push the Docker image to the Scaleway Container Registry.

<Message type="note">
    The `on.workflow_dispatch` node in the workflow YAML tree specifies that this workflow can be run manually in GitHub, which is the path that we chose in this tutorial. There are [many other events](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows) that you can choose from to trigger your workflow, such as a push or a merge.
</Message>

### Launch the workflow

The workflow is now ready to be deployed. Commit and push your `build.yml` file, then go back to your repository's home page on GitHub.
In the **Actions** tab, you should be able to find your newly created workflow. Click on its name, then on the **Run workflow** menu. Finally, hit the **Run workflow** button.

<Lightbox image={image2} alt="" />

Wait a few seconds for the workflow to launch, and you should be able to monitor its run.

That's it. Your workflow will build your Docker image and deploy it to your Scaleway Container Registry.