Skip to content

feat: Add unity-activate action for Unity Docker container environment setup - #28

Draft
kochounoyume with Copilot wants to merge 5 commits into
mainfrom
copilot/docker-container-setup-again
Draft

feat: Add unity-activate action for Unity Docker container environment setup#28
kochounoyume with Copilot wants to merge 5 commits into
mainfrom
copilot/docker-container-setup-again

Conversation

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Replaces a hardcoded docker run command with a reusable composite GitHub Action that builds and starts a Unity editor container with the specified project mounted and ready to use.

New: actions/unity-activate/

Two-file structure: Dockerfile + action.yml.

Dockerfile

  • Parameterizes the Unity editor image via ARG UNITY_EDITOR_IMAGE / FROM ${UNITY_EDITOR_IMAGE} — version is supplied at docker build time
  • Uses the shell form of ENTRYPOINT to inline commands directly — no script file created at any layer:
    • Handles dbus machine-id setup (required by Unity)
    • Keeps container alive with exec tail -f /dev/null for subsequent docker exec steps
    • Commands are chained with && for fail-fast behaviour

action.yml — composite action with three steps:

  1. docker build --build-arg UNITY_EDITOR_IMAGE=<input> — builds the container image
  2. docker run -d — starts the container detached; mounts project-path/workspace
  3. Verification — checks container is running, dumps logs on failure

Inputs

Input Default Description
editor-image (required) Full image ref, e.g. unityci/editor:6000.3.2f1-linux-il2cpp-3.2.1
project-path ${{ github.workspace }} Host path of the Unity project to mount into the container at /workspace
container-name unity-agent Container name for subsequent docker exec calls

Usage

- uses: AndanteTribe/Actions/actions/unity-activate@main
  with:
    editor-image: unityci/editor:6000.3.2f1-linux-il2cpp-3.2.1
    project-path: ${{ github.workspace }}/MyUnityProject  # defaults to github.workspace
Original prompt

This section details on the original issue you should resolve

<issue_title>Dockerコンテナ構築</issue_title>
<issue_description>```
docker run -d
--name unity-agent
-e UNITY_SERIAL
-e UNITY_EMAIL
-e UNITY_PASSWORD
-v "/tmp/BlankProject:/BlankProject"
-v "${{ github.workspace }}:/workspace"
unityci/editor:6000.3.2f1-linux-il2cpp-3.2.1
bash -c '
dbus-uuidgen > /etc/machine-id &&
mkdir -p /var/lib/dbus &&
ln -sf /etc/machine-id /var/lib/dbus/machine-id &&
mkdir -p /BlankProject/Assets &&

    unity-editor -batchmode -nographics -quit \
      -serial "$UNITY_SERIAL" \
      -username "$UNITY_EMAIL" \
      -password "$UNITY_PASSWORD" \
      -projectPath /BlankProject &&

    tail -f /dev/null
  '

こんな感じでunityの仮想コンテナを立ち上げられるはず.

今は決め打ちでコマンドに入れてしまっているが、GameCIのAction(Unity Builder)などを参考に、最低限の引数を用意したaction.ymlを作ってほしい.

BlankProjectなど、適当な決め打ちデータでコマンド作っているので、これらを引数にする感じで.

ほかのaction.ymlを参照してほしいが、まずこれをdockerfileに書き起こすところから始めよう.(なお、UNITY_SERIAL, UNITY_EMAIL, UNITY_PASSWORDはセキュリティリスクがあるので、引数ではなく環境変数でお願い)</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: kochounoyume <78918084+kochounoyume@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Docker container setup for Unity agent feat: Add unity-activate action for parameterized Unity Docker container setup Mar 10, 2026
@kochounoyume

Copy link
Copy Markdown
Member

@copilot shファイル必要?できればdockerfileとaction.ymlの二構成にしてほしい

…oint.sh

Co-authored-by: kochounoyume <78918084+kochounoyume@users.noreply.github.com>

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot shファイル必要?できればdockerfileとaction.ymlの二構成にしてほしい

Removed entrypoint.sh and embedded the script directly into the Dockerfile using BuildKit heredoc syntax (# syntax=docker/dockerfile:1). The action is now a clean two-file structure: Dockerfile + action.yml only. (fa1dff6)

@kochounoyume

Copy link
Copy Markdown
Member

@copilot Dockerfileで ENTRYPOINT と書くやり方(内部的にもshファイルを作らないやり方)でやってほしい

Co-authored-by: kochounoyume <78918084+kochounoyume@users.noreply.github.com>

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Dockerfileで ENTRYPOINT と書くやり方(内部的にもshファイルを作らないやり方)でやってほしい

Switched to the shell form of ENTRYPOINT — the activation commands are now chained directly inline with &&. No RUN layer, no script file created anywhere. (c8dd682)

@kochounoyume

Copy link
Copy Markdown
Member

@copilot blankprojectって書いたのはただの例で、今回の目標は指定したパスのunityプロジェクトをdockerコンテナ上で触れるようにすることなので、ライセンス認証用のプロジェクトとかはいらない.
今一度、「指定されたunityプロジェクトを環境構築する」を目指して実装見直してほしい

…ctivation

Co-authored-by: kochounoyume <78918084+kochounoyume@users.noreply.github.com>

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot blankprojectって書いたのはただの例で、今回の目標は指定したパスのunityプロジェクトをdockerコンテナ上で触れるようにすることな...

実装を見直しました。(2464d6d)

変更内容:

  • Dockerfile: ライセンス認証コマンド(unity-editor -batchmode -quit、資格情報など)をすべて削除。ENTRYPOINT は dbus のセットアップとコンテナの維持(tail -f /dev/null)のみ
  • action.yml: blank-project-path と資格情報の環境変数を削除。代わりに project-path 入力(デフォルト: ${{ github.workspace }})を追加し、コンテナ内の /workspace にマウント

使い方:

- uses: AndanteTribe/Actions/actions/unity-activate@main
  with:
    editor-image: unityci/editor:6000.3.2f1-linux-il2cpp-3.2.1
    project-path: ${{ github.workspace }}/MyUnityProject  # 省略時は github.workspace

Copilot AI changed the title feat: Add unity-activate action for parameterized Unity Docker container setup feat: Add unity-activate action for Unity Docker container environment setup Mar 10, 2026
@kochounoyume

Copy link
Copy Markdown
Member

@copilot 認証が目的ではなくて、docker環境を立ち上げてそれを全体のアクションが終わるまで維持するような、そういう環境構築actionが目的なのだが、それは達成できるだろうか?

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 認証が目的ではなくて、docker環境を立ち上げてそれを全体のアクションが終わるまで維持するような、そういう環境構築actionが目的なのだが��...

はい、現在の実装で既にその目的は達成できています。

仕組みは以下の通りです:

  • docker run -d でコンテナをデタッチモードで起動します(ワークフローステップをブロックしない)
  • DockerfileENTRYPOINT 末尾の exec tail -f /dev/null により、コンテナはワークフロー全体が終わるまで起動し続けます
  • Unityプロジェクトは /workspace にマウントされているので、後続のステップから docker exec unity-agent <command> で操作できます

使用例:

- uses: AndanteTribe/Actions/actions/unity-activate@main
  with:
    editor-image: unityci/editor:6000.3.2f1-linux-il2cpp-3.2.1
    project-path: ${{ github.workspace }}/MyUnityProject

# 以降のステップでコンテナを使用
- name: Run Unity build
  run: docker exec unity-agent unity-editor -batchmode -nographics -quit -projectPath /workspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dockerコンテナ構築

2 participants