Search code examples
javaamazon-web-servicesspring-bootdockeramazon-ecr

Docker Image Issue in ECR (Error: Invalid or corrupt jarfile /app.jar)


FROM openjdk:11

VOLUME /tmp

ARG JAR_FILE

COPY ${JAR_FILE} app.jar

ENTRYPOINT ["java","-jar","/app.jar"]

This is my Docker file for spring boot app and I am pushing it to the ECR directly from Github actions. I can see the image pushed to the ECR while running the task with the image this is the error I get in task log.

Is there something missing in docker file.

(Error: Invalid or corrupt jarfile /app.jar)

Solution

  • I did wrong with the docker file below:

    FROM openjdk:11
    ARG JAR_FILE=target/truckee-app.jar  ** this was missing
    COPY ${JAR_FILE} app.jar
    ENTRYPOINT ["java","-jar","/app.jar"]