Skip to content

Add dockerfile to your webapp #28

@Afroz-J-Shaikh

Description

@Afroz-J-Shaikh

I have containerized your web-app

You can add dockerfile to your repo :

Dockerfile

       FROM maven:3.9.12-eclipse-temurin-17 AS build

       WORKDIR /app

       COPY . .

       RUN mvn clean package -DskipTests

       RUN ls -a

       FROM tomcat:10.1-jdk17

       COPY --from=build /app/target/java-hello-world.war /usr/local/tomcat/webapps/

       EXPOSE 8080

       CMD ["catalina.sh","run"]

How to run

   docker build -t my-webapp .

   docker run -d -p 8080:8080 my-webapp

Access it on localhost

   http://localhost:8080/java-hello-world/

ThankYou

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions