diff --git a/Dockerfile b/Dockerfile index fe62d98..af636c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use node:alpine3.17 image as the base image -FROM docker.io/node:alpine3.17 +FROM docker.io/node:alpine3.17 as builder # Maintainer information MAINTAINER tanwenyang@aliyun.com @@ -16,5 +16,11 @@ WORKDIR /app # Set the Yarn registry to Taobao mirror and install dependencies using yarn install RUN yarn config set registry 'https://registry.npm.taobao.org' && yarn install && yarn cache clean -# Run the command to start the container, which will run the project in development mode and listen on port 5173 of address 0.0.0.0 -CMD yarn dev --host 0.0.0.0 +# Building the html code +RUN yarn build + +# Using nginx for production +FROM docker.io/nginxinc/nginx-unprivileged:1.25.1-alpine + +# Copy html from previous stage +COPY --from=builder /app/dist /usr/share/nginx/html