diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 140f560..d56b4c4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -52,7 +52,7 @@ jobs: run: | cd quarkus-app && ./mvnw package # cd ../micronaut-app && ./mvnw package - # cd ../spring-app && ./mvnw package + cd ../spring-app && ./mvnw package && mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar) # end::adocBuild[] # tag::adocPush[] @@ -72,13 +72,13 @@ jobs: # file: ./micronaut-app/Dockerfile # context: ./micronaut-app/ - # - name: Build and push Spring container to registry - # uses: docker/build-push-action@v2 - # with: - # push: true - # tags: ${{ env.REGISTRY_URL }}/${{ env.PROJECT }}/${{ env.SPRING_APP }}:${{ github.sha }} - # file: ./spring-app/Dockerfile - # context: ./spring-app/ + - name: Build and push Spring container to registry + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ env.REGISTRY_URL }}/${{ env.PROJECT }}/${{ env.SPRING_APP }}:${{ github.sha }} + file: ./spring-app/src/main/docker/Dockerfile.jvm + context: ./spring-app/ # end::adocPush[] # tag::adocDeploy[] @@ -113,8 +113,8 @@ jobs: # --resource-group ${{ env.RESOURCE_GROUP }} \ # --image ${{ env.REGISTRY_URL }}/${{ env.PROJECT }}/${{ env.MICRONAUT_APP }}:${{ github.sha }} - # az containerapp update \ - # --name ${{ env.SPRING_APP }} \ - # --resource-group ${{ env.RESOURCE_GROUP }} \ - # --image ${{ env.REGISTRY_URL }}/${{ env.PROJECT }}/${{ env.SPRING_APP }}:${{ github.sha }} + az containerapp update \ + --name ${{ env.SPRING_APP }} \ + --resource-group ${{ env.RESOURCE_GROUP }} \ + --image ${{ env.REGISTRY_URL }}/${{ env.PROJECT }}/${{ env.SPRING_APP }}:${{ github.sha }} # end::adocDeploy[] diff --git a/springboot-app/pom.xml b/springboot-app/pom.xml index e57ab75..bd9c09a 100644 --- a/springboot-app/pom.xml +++ b/springboot-app/pom.xml @@ -62,6 +62,11 @@ org.springframework.boot spring-boot-maven-plugin + + + true + + diff --git a/springboot-app/src/main/docker/Dockerfile.jvm b/springboot-app/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000..f7e8d10 --- /dev/null +++ b/springboot-app/src/main/docker/Dockerfile.jvm @@ -0,0 +1,8 @@ +FROM --platform=linux/amd64 eclipse-temurin:19-jre-alpine +RUN addgroup -S spring && adduser -S spring -G spring +USER spring:spring +ARG DEPENDENCY=target/dependency +COPY ${DEPENDENCY}/BOOT-INF/lib /app/lib +COPY ${DEPENDENCY}/META-INF /app/META-INF +COPY ${DEPENDENCY}/BOOT-INF/classes /app +ENTRYPOINT ["java","-cp","app:app/lib/*","io.containerapps.javaruntime.workshop.springboot.SpringbootApplication"]