1. Create a Dockerfile in the root directory and paste the following content
FROM node as builder
WORKDIR /app
COPY . .
RUN npm run build

FROM node
RUN npm install -g serve
WORKDIR /app
COPY --from=builder /app/build .
CMD ["serve"."-p"."8001"."-s"."."]

Copy the code
  1. Build (hello-app is the name of the current test)
docker build -t hello-app .
Copy the code
  1. View the current Docker image

  1. Run the current image (test for success)
docker run -it -p 8001:8001 hello-app
Copy the code

  1. Modify the tag and push it to the remote library
docker tag hello-app `remote-name`/hello-app
docker push `remote-name`/hello-app:`tag`
Copy the code