diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eff7575 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Use a base image with Java and Maven pre-installed +FROM maven:latest + +# Set the working directory in the container +WORKDIR /app + +# Clone the repository into the container +RUN git clone https://github.com/JeremyTsaii/leetcode-stats-api.git . +# Run Maven clean command +RUN mvn clean + +# Run Maven package command +RUN mvn package + +# Expose the port used by Apache Tomcat +EXPOSE 8080 + +# Command to serve the Apache Tomcat servlet container +CMD ["mvn", "spring-boot:run"] diff --git a/README.md b/README.md index 0e0e072..080cc51 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,12 @@ Serves the Apache Tomcat servlet container on http://localhost:8080. #### `mvn test` Runs all the tests. + +## By using Docker + +first build the docker image + +### docker build -t . + +run the docker container +### docker run -d -p 8080:8080