Build the docker image to build and deploy with sprin

Here's an example Dockerfile to build an image that includes both Spring Boot and Angular:


```dockerfile

# Base image

FROM openjdk:11-jdk-slim AS build


# Set the working directory

WORKDIR /app


# Install Node.js and npm

RUN apt-get update && \

    apt-get install -y curl gnupg && \

    curl -sL https://deb.nodesource.com/setup_14.x | bash - && \

    apt-get install -y nodejs


# Install Angular CLI globally

RUN npm install -g @angular/cli


# Copy the source code for the Spring Boot app and build it

COPY spring-boot-app spring-boot-app

RUN cd spring-boot-app && \

    ./mvnw clean package -DskipTests


# Copy the source code for the Angular app and build it

COPY angular-app angular-app

RUN cd angular-app && \

    npm install && \

    ng build --prod


# Final image

FROM openjdk:11-jdk-slim


# Set the working directory

WORKDIR /app


# Copy the built JAR file from the build image

COPY --from=build /app/spring-boot-app/target/*.jar app.jar


# Expose the port that the Spring Boot app runs on

EXPOSE 8080


# Run the Spring Boot app

ENTRYPOINT ["java","-jar","app.jar"]

```


In this example Dockerfile, we first start with a base image that includes OpenJDK 11. We then install Node.js and npm, and install the Angular CLI globally.


Next, we copy the source code for both the Spring Boot app and the Angular app into the container, and build them separately. The Spring Boot app is built using the Maven wrapper (`./mvnw`) and the Angular app is built using the `ng build` command.


Finally, we create a new image from the OpenJDK 11 base image, and copy the built JAR file from the Spring Boot app into the container. We also expose the port that the Spring Boot app runs on (port 8080), and set the entry point to run the Spring Boot app.


To build the image, you can run the following command in the directory containing the Dockerfile:


```

docker build -t my-app-image .

```


This will build the Docker image and tag it with the name `my-app-image`. You can then run the image using the following command:


```

docker run -p 8080:8080 my-app-image

```


This will start a container running the image, and forward port 8080 from the container to port 8080 on the host machine. You should be able to access the Spring Boot app by navigating to `http://localhost:8080` in a web browser.