Browse Source

update dockerfile

Zhang Li 2 years ago
parent
commit
5fe0fe46c4
4 changed files with 34 additions and 2 deletions
  1. 2 0
      .env.idctest
  2. 24 0
      Dockerfile.idctest
  3. 6 1
      Makefile
  4. 2 1
      package.json

+ 2 - 0
.env.idctest

@@ -0,0 +1,2 @@
+REACT_APP_BASE_URL = 'http://aihub-dag-idctest.digitalyili.com/'
+REACT_APP_JPT = 'http://aihub-dag-jpt-idctest.digitalyili.com'

+ 24 - 0
Dockerfile.idctest

@@ -0,0 +1,24 @@
+FROM node:14-buster as build
+WORKDIR /workspace
+COPY package.json .
+RUN npm install
+ADD . /workspace
+RUN npm run build:idctest
+
+
+FROM nginx:mainline
+WORKDIR /usr/share/nginx/html
+COPY --from=build /workspace/build /usr/share/nginx/html/dag
+RUN echo "\
+server {\n\
+    listen 80;\n\
+    listen [::]:80;\n\
+\n\
+    root /usr/share/nginx/html/dag;\n\
+    index index.html index.htm;\n\
+\n\
+    location / {\n\
+    try_files \$uri \$uri/ /index.html;\n\
+    }\n\
+}\n\
+" > /etc/nginx/conf.d/default.conf

+ 6 - 1
Makefile

@@ -8,4 +8,9 @@ image-dev = SXKJ:32775/yili-dag-frontend:$(build_date)
 dev:
 	@docker build . \
 			-t $(image-dev) \
-			-f Dockerfile
+			-f Dockerfile
+
+
+idctest:
+	@docker build . -t registry.cn-hangzhou.aliyuncs.com/sxtest/dag-frontend:idctest -f Dockerfile.idctest
+	@docker push registry.cn-hangzhou.aliyuncs.com/sxtest/dag-frontend:idctest

+ 2 - 1
package.json

@@ -35,6 +35,7 @@
     "start:prod": "dotenv -e .env.production react-scripts start",
     "build:dev": "dotenv -e .env.development react-scripts build",
     "build:prod": "dotenv -e .env.production react-scripts build",
+    "build:idctest": "dotenv -e .env.idctest react-scripts build",
     "test": "react-scripts test",
     "eject": "react-scripts eject"
   },
@@ -60,4 +61,4 @@
     "cross-env": "^7.0.3",
     "dotenv-cli": "^6.0.0"
   }
-}
+}