testcontainers / testcontainers/testcontainers-java

Creating Testcontainer from custom image doesn't work

オープン
#831 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

resolution/acknowledged type/question
主要言語
Java
スター
8.7k
フォーク
1.9k
平均マージ
2日 17時間
マージ済み PR(30日)
9

説明

I'm writing tests for my room-service and i need the image-service because the room-service has dependencies on the image-service. this is my file tree:

+---image-service
¦   ¦   Dockerfile
¦   ¦   pom.xml
¦   ¦
¦   +---src
¦   ¦   +---main
¦   ¦   ¦   +---java
¦   ¦   ¦   +---resources
¦   ¦   +---test
¦   ¦       +---java
¦   ¦           +---de
¦   ¦               +---fh
¦   ¦                       ApplicationTest.java
+---room-service
¦   ¦   Dockerfile
¦   ¦   pom.xml
¦   ¦
¦   +---src
¦   ¦   +---main
¦   ¦   ¦   +---java
¦   ¦   ¦   +---resources
¦   ¦   +---test
¦   ¦       +---java
¦   ¦       ¦   +---de.fh
¦   ¦       ¦           ApplicationTest.java
¦   ¦       ¦
¦   ¦       +---resources
¦   ¦               application.yml

In my ApplicationTest in room-service I try to create a generic container from the dockerfile in /image-service/Dockerfile:

@BeforeClass
public static void init() {
    eurekaContainer = new GenericContainer(new ImageFromDockerfile("image-service")
            .withFileFromFile("./image-service", new File("../image-service/Dockerfile")));

    eurekaContainer.start();
}

I couldn't find any use cases like this in the documentation.
Am I using the wrong method? Are any of the paths I used wrong?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

room-service/src/test/java/.../ApplicationTest.java と参照されている image-service/Dockerfile から始めます。ImageFromDockerfile と withFileFromFile がパスをどのように解決するかを確認し、room-service のテストを実行します。カスタムイメージがビルドされ、コンテナが正常に起動すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, java
領域
devops, testing
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。