AATHITH RAJENDRAN :
I have a jar
file, pom
file and config.yml
file along with dockerfile
inside a folder named app which is in /Desktop. How can I pack all those files into a docker image?
This is my current docker file. What should I change?
FROM java:8
WORKDIR /
ADD /Desktop/app $HOME/app
CMD ["java", "-jar", "appserver.jar", "server", "config.yml"]
Thanh Nguyen Van :
You could start with this simple Dockerfile:
FROM java:8
WORKDIR /
ADD app /app
CMD ["java", "-jar", "/app/appserver.jar", "server", "/app/config.yml"]
The Dockerfile should be created in a directory which contains also the app directory with your appserver.jar and config.yml files:
├── workdir/
│ ├── Dockerfile
│ └── app/
| ├── application.jar
| └── config.yml
Now, to build the docker image, run, in the workdir, the following command:
docker build -t app-name:1.0 .