From 58a692431a48ef9ed728e70e696803fb6cf9326a Mon Sep 17 00:00:00 2001 From: suraj-zemoso Date: Wed, 20 Jul 2022 21:43:14 +0530 Subject: [PATCH] Dockerize OneMock server --- Server/src/main/docker/Dockerfile | 13 +++++++++++++ Server/src/main/docker/README.md | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Server/src/main/docker/Dockerfile create mode 100644 Server/src/main/docker/README.md diff --git a/Server/src/main/docker/Dockerfile b/Server/src/main/docker/Dockerfile new file mode 100644 index 0000000..cd99881 --- /dev/null +++ b/Server/src/main/docker/Dockerfile @@ -0,0 +1,13 @@ +FROM openjdk:11-slim + +WORKDIR /apps + +COPY target/*.jar /apps/onemock-v1.1.jar + +EXPOSE 8080 + +ENTRYPOINT [ \ + "java",\ + "-jar",\ + "/apps/onemock-v1.1.jar"\ +] \ No newline at end of file diff --git a/Server/src/main/docker/README.md b/Server/src/main/docker/README.md new file mode 100644 index 0000000..adb7bc1 --- /dev/null +++ b/Server/src/main/docker/README.md @@ -0,0 +1,18 @@ +### To utilize docker functionality for the onemock server, Please follow instructions mentioned below + +#### 1. Change the directory to `./Server` + +#### 2. Execute following command to generate Jar + +``mvn clean package -DskipTests`` + +It will gererate the jar and place it in the `../target` directory +#### 3. Next, execute following command to create an docker image for onemock server + +``docker image build -t onemock . -f src/main/docker/Dockerfile`` + +#### 4. Finally, start docker container with + +``docker run --name onemock -p 8080:8080 onemock:latest`` + +and in browser, open ``http://localhost:8080`` \ No newline at end of file