-1
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)
vaibhavsahu
  • 612
  • 2
  • 7
  • 19
  • 3
    you can alway try locally first, via `java -jar ...`, before pushing it anywhere – Eugene Sep 18 '21 at 02:26
  • 1
    This isn't an Amazon ECR issue, it's an issue with the way you are building the Docker image before pushing it to ECR. As mentioned above, try running the docker image locally first. – Mark B Sep 18 '21 at 15:06

1 Answers1

2

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"]
Fabio Mendes Soares
  • 1,357
  • 5
  • 20
  • 30