Skip to content

Remove Elixir template main.ex to avoid module conflict#70

Merged
toshi0806 merged 1 commit intomainfrom
issue-69-remove-main-ex
Oct 30, 2025
Merged

Remove Elixir template main.ex to avoid module conflict#70
toshi0806 merged 1 commit intomainfrom
issue-69-remove-main-ex

Conversation

@toshi0806
Copy link
Member

目的

コンテナイメージビルド時に/judge/main/lib/main.exを削除し、ユーザーのMain.exとのモジュール競合を根本的に解決します。

Resolves #69

問題

現在のコンテナイメージには/judge/main/lib/main.exというテンプレートファイルが含まれており、ユーザーのMain.exと同じMainモジュールを定義するため競合が発生していました。

現状の回避策

atcoder-env側で以下の回避策を実装済みです(PR #111):

  • .postCreateContainer.shmain.exを削除
  • makefileでElixirのビルド時にエラーメッセージがMain.exの行番号を正確に表示

解決策

変更内容

両バージョンのDockerfileにmain.ex削除コマンドを追加:

Dockerfile.lite(267行目):
```dockerfile

Remove Elixir template main.ex to avoid module conflict with user's Main.ex

RUN rm -f /judge/main/lib/main.ex
```

Dockerfile(364行目):
```dockerfile

Remove Elixir template main.ex to avoid module conflict with user's Main.ex

RUN rm -f /judge/main/lib/main.ex
```

配置場所

Elixirプロジェクトがbuilderからコピーされた直後に削除:

  • Dockerfile.lite: COPY --from=builder /opt/elixir-project /judge/ の直後
  • Dockerfile: COPY --from=builder /opt/elixir-project /judge/ の直後

メリット

  1. 責務の明確化: イメージ側の問題をイメージ側で解決
  2. シンプルな運用: atcoder-env側の回避策が冗長になるが、後方互換性は維持
  3. 将来的な保守性: イメージとenv側の依存関係が減る
  4. クリーンな初期状態: 新規ユーザーは最初からクリーンな環境を取得

影響範囲

  • 破壊的変更なし: atcoder-envの回避策(.postCreateContainer.shでの削除)が引き続き動作
  • 既存ユーザーへの影響なし: .postCreateContainer.shで既に削除済み
  • 新規ユーザーへのメリット: よりクリーンな初期状態
  • 両バージョン対応: Lite版とFull版の両方で一貫した動作

関連情報

- Add RUN command in Dockerfile.lite to remove /judge/main/lib/main.ex
- Add RUN command in Dockerfile (full) to remove /judge/main/lib/main.ex
- Prevents module conflict between template and user's Main.ex
- Resolves issue #69
@toshi0806 toshi0806 merged commit da6b28b into main Oct 30, 2025
5 checks passed
@toshi0806 toshi0806 deleted the issue-69-remove-main-ex branch October 30, 2025 05:57
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.

Remove main.ex template from Elixir judge directory in container image

1 participant