diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 41979db..b2cb417 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,6 +21,13 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + cache: 'maven' + - name: Build with Maven + run: mvn -B package --file pom.xml - name: Check Dockerfile run: | @@ -33,7 +40,6 @@ jobs: context: . push: false tags: ${{ env.IMAGE_NAME }} - #platforms: linux/amd64,linux/arm64 labels: ${{ env.IMAGE_NAME }} - name: Check vulnerabilities @@ -49,8 +55,8 @@ jobs: - name: Test the container run: | - sleep 5 - curl --silent --retry 3 --include http://127.0.0.1:9500/ping | grep "200 OK" + sleep 10 + curl --silent --retry 3 --include http://127.0.0.1:9500/ping | grep "HTTP/1.1 200" [ $? -ne 0 ] && (echo "error"; exit 1) exit 0 diff --git a/Dockerfile b/Dockerfile index b1f362c..bdc077e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,12 @@ -FROM eclipse-temurin:latest +FROM eclipse-temurin:21.0.3_9-jre # アプリケーションのインストール RUN mkdir /app WORKDIR /app -COPY --chown=65534:65534 target/rest-service-0.0.1.jar /app/rest-service.jar +COPY --chown=65534:65534 target/rest-service-1.0.0.jar /app/rest-service.jar # コンテナの設定 USER 65534:65534 EXPOSE 8080 CMD ["java", "-jar", "/app/rest-service.jar"] + diff --git a/README.md b/README.md index 53d3056..b138dd7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +# Javaで作るコンテナイメージ ## ディレクトリ構造 diff --git a/pom.xml b/pom.xml index e932e82..fd98c70 100644 --- a/pom.xml +++ b/pom.xml @@ -10,11 +10,11 @@ com.example rest-service - 0.0.1 + 1.0.0 rest-service Demo project for Spring Boot - 17 + 21