---
title: Build in a container with GitHub Actions
product: Unity Editor
version: '6000.7'
latest_version: '7000.0'
status: This page documents version 6000.7. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/6000.7/manual/building-and-publishing/docker/github-actions
latest_url: https://docs.unity.com/en-us/engine/7000.0/manual/building-and-publishing/docker/github-actions.md
last_updated: 2026-11-06
generated_at: 2026-11-11T01:55:35.004Z
locale: en-us
---

# Build in a container with GitHub Actions

> Run containerized Unity builds from a GitHub Actions workflow on a self-hosted runner.

Run containerized Unity builds from a GitHub Actions workflow on a self-hosted runner.

GitHub Actions can run a job's steps inside a container started from your Editor image. This example builds your project for the Web platform, caches the `Library` folder between runs, and uploads the build as an artifact.

## Prerequisites

1. An Editor image in a registry your build agent can pull from. For more information, refer to [Build a Unity Editor Docker image](/engine/6000.7/manual/building-and-publishing/docker/build-image.md).
2. A [self-hosted runner](https://docs.github.com/en/actions/concepts/runners/self-hosted-runners) on a Linux x64 machine on the same private network as your license server.
3. A license server configuration file, `services-config.json`, at `/etc/unity/services-config.json` on the runner machine. For the file's content, refer to [Build with Unity in a Docker container](/engine/6000.7/manual/building-and-publishing/docker/run-build.md).
4. The user or group that the container's actions run as has write access to the files and folders mounted into the container.
5. `git` and `git-lfs` installed in your Editor image. The `actions/checkout` step runs inside the container, so it can't use the runner machine's Git to check out the repository and its Git LFS files.
6. A build method in your project, such as `BuildScript.BuildWeb` in [Run the build](/engine/6000.7/manual/building-and-publishing/docker/run-build.md#run-the-build).

## Add the build workflow

To add the build workflow:

1. Create a workflow file in your repository, such as `.github/workflows/build-web.yml`, with the following content:

   ```lang-yaml
   name: Build for Web
   on:
     push:
     workflow_dispatch:
   jobs:
     build-web:
       runs-on: [self-hosted, linux, x64]
       container:
         image: ghcr.io/my-studio/unity-editor:6000.7.0f1-webgl-android
         options: >-
           --shm-size=8g
           -v /etc/unity/services-config.json:/usr/share/unity3d/config/services-config.json:ro
       steps:
         - uses: actions/checkout@v4
           with:
             lfs: true
         - uses: actions/cache@v4
           with:
             path: Library
             key: library-web-${{ hashFiles('Packages/packages-lock.json') }}
         - name: Build
           run: >-
             /opt/unity/editors/6000.7.0f1/Editor/Unity
             -batchmode -nographics
             -projectPath .
             -buildTarget WebGL
             -executeMethod BuildScript.BuildWeb
             -logFile -
             -quit
         - uses: actions/upload-artifact@v4
           with:
             name: web
             path: Build/Web
   ```

   The workflow runs on every push and on demand. The `container` section starts the job in your Editor image with 8 GB of shared memory and mounts the license server configuration file read-only. The `actions/cache` step saves and restores the `Library` folder under a key derived from `Packages/packages-lock.json`, so jobs reuse the `Library` folder until your packages change.

2. Commit the workflow file and push it to your repository.

GitHub Actions runs the build on your self-hosted runner and uploads the Web build as the `web` artifact. If the build method fails, the Editor exits with a nonzero code and the job fails.

## Additional resources

* [Build with Unity in a Docker container](/engine/6000.7/manual/building-and-publishing/docker/run-build.md)
* [Troubleshooting the Headless Editor in Docker](/engine/6000.7/manual/building-and-publishing/docker/troubleshooting.md)
* [Build a Unity Editor Docker image](/engine/6000.7/manual/building-and-publishing/docker/build-image.md)
