energywebfoundation / ocn-node

Apache License 2.0
5 stars 4 forks source link

v1.1.0-rc1 docker image has incorrect command #19

Closed ewf-devops closed 4 years ago

ewf-devops commented 4 years ago

Original report by Adam Staveley (Bitbucket: [Adam Staveley](https://bitbucket.org/Adam Staveley), GitHub: adamstaveley).


The image with tag “1.1.0-rc1”, available at https://hub.docker.com/r/openchargingnetwork/ocn-node, does not include the correct command.

Steps to reproduce

docker run -it -p 8080:8080 openchargingnetwork/ocn-node:1.1.0-rc1 

As shown on https://hub.docker.com/layers/openchargingnetwork/ocn-node/1.1.0-rc1/images/sha256-8ae4a2ef5443fb3627a7309f7b47e069c8793f01af6d681f65a0c3f5cf0e911a?context=explore, the image tries to run the JAR file for version 1.0, rather than 1.1.0-rc1. This results in an error stating the file cannot be accessed.

How to Fix

The develop branch’s Dockerfile is the culprit: https://bitbucket.org/shareandcharge/ocn-node/src/develop/Dockerfile. The command line should be changed from:

CMD ["java", "-jar", "./libs/ocn-node-1.0.0.jar"]

to:

CMD ["java", "-jar", "./libs/ocn-node-1.1.0-rc1.jar"]

As a current workaround, it is possible to modify the command at runtime:

docker run -it -p 8080:8080 openchargingnetwork/ocn-node:1.1.0-rc1 java -jar ./libs/ocn-node-1.1.0-rc1.jar

Additional thoughts

To avoid issues like this it is perhaps worth removing the version number from the artifact filename. To identify the version of a node, an endpoint could be added which reads from the version number set in the Gradle build script.

ewf-devops commented 4 years ago

Original comment by John Henderson (Bitbucket: [John Henderson](https://bitbucket.org/John Henderson), GitHub: jrhender).


v1.1.0-rc2 image is pushed with the correct command