poster-design/docker/web/Dockerfile
2024-12-17 15:53:28 +08:00

30 lines
598 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM node:20-alpine AS builder
WORKDIR /usr/src/app
# 复制其余的源代码
COPY ./ ./
RUN npm i --registry=https://registry.npmmirror.com
RUN npm run build
# 使用官方的nginx基础镜像
FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/nginx_optimized
# 设置工作目录
WORKDIR /usr/share/nginx/html
COPY --from=builder /usr/src/app/dist /usr/share/nginx/html
COPY ./docker/web/static.conf /etc/nginx/default.d/
# 暴露80端口和443端口如果你使用HTTPS
EXPOSE 80 443
# 使用自定义entrypoint启动
CMD ["nginx", "-g", "daemon off;"]