Selaa lähdekoodia

调整docker配置

zhangqiang 10 kuukautta sitten
vanhempi
commit
2f60d03d8b
1 muutettua tiedostoa jossa 18 lisäystä ja 10 poistoa
  1. 18 10
      jeecgboot-vue3/Dockerfile

+ 18 - 10
jeecgboot-vue3/Dockerfile

@@ -1,13 +1,19 @@
-FROM nginx
-MAINTAINER 229230041@qq.com
-VOLUME /tmp
-ENV LANG en_US.UTF-8
-RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
-&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list  \
-&& apt update \
-&& apt install yarn \
-    && yarn install \
-    && yarn build
+# 设置基础镜像
+FROM node:lts-alpine as build-stage
+# 定义作者
+LABEL maintainer=Zenas
+
+#创建一个工作目录
+WORKDIR /jeecgboot-vue3
+
+RUN npm install -g pnpm
+RUN pnpm install --registry=https://registry.npm.taobao.org
+RUN pnpm build
+
+# production stage
+FROM nginx:stable-alpine as production-stage
+COPY --from=build-stage /jeecgboot-vue3/dist /usr/share/nginx/html
+
 RUN echo "server {  \
                       listen       80; \
                       location   /shop-api/ { \
@@ -32,5 +38,7 @@ RUN echo "server {  \
     &&  mkdir -p /var/www/html
 
 ADD dist/ /var/www/html/
+# 暴露镜像端口
 EXPOSE 80
 EXPOSE 443
+CMD ["nginx","-g","daemon off"]