From 7bc1c3316a8757233a01a9f3eeee79a8523f74d9 Mon Sep 17 00:00:00 2001 From: marvzhang Date: Tue, 27 Jul 2021 14:43:57 +0800 Subject: [PATCH] updated Dockerfile --- Dockerfile | 2 +- Dockerfile.cn | 2 +- README.md | 3 +-- docker_init.sh | 4 ++-- frontend/.env.docker | 2 ++ frontend/package.json | 1 + 6 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 frontend/.env.docker diff --git a/Dockerfile b/Dockerfile index 0f833b61..e1c5f3fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ WORKDIR /app #RUN npm config set unsafe-perm true #RUN npm install -g yarn && yarn install -RUN yarn install && yarn run build +RUN yarn install && yarn run build:docker # images FROM ubuntu:latest diff --git a/Dockerfile.cn b/Dockerfile.cn index 20243c68..a682264f 100644 --- a/Dockerfile.cn +++ b/Dockerfile.cn @@ -19,7 +19,7 @@ RUN rm /app/.npmrc #RUN npm config set unsafe-perm true #RUN npm install -g yarn && yarn install -RUN yarn install && yarn run build +RUN yarn install && yarn run build:docker # images FROM ubuntu:latest diff --git a/README.md b/README.md index ddc435f6..3fa12d89 100644 --- a/README.md +++ b/README.md @@ -41,15 +41,14 @@ Three methods: ### Pre-requisite (Docker) - Docker 18.03+ -- Redis 5.x+ - MongoDB 3.6+ - Docker Compose 1.24+ (optional but recommended) ### Pre-requisite (Direct Deploy) - Go 1.12+ - Node 8.12+ -- Redis 5.x+ - MongoDB 3.6+ +- SeaweedFS ## Quick Start diff --git a/docker_init.sh b/docker_init.sh index b39acb3a..ae42334a 100755 --- a/docker_init.sh +++ b/docker_init.sh @@ -1,8 +1,8 @@ #!/bin/bash # replace absolute api url to relative -jspath=`ls /app/dist/js/app.*.js` -sed -i "s?http:\/\/localhost:8000?\/api?g" ${jspath} +jspath=`ls /app/dist/js/index.*.js` +sed -i "s?###VUE_APP_API_BASE_URL###?\/api?g" ${jspath} # replace default api path to new one # if [ "${CRAWLAB_API_ADDRESS}" = "" ]; diff --git a/frontend/.env.docker b/frontend/.env.docker new file mode 100644 index 00000000..672216dd --- /dev/null +++ b/frontend/.env.docker @@ -0,0 +1,2 @@ +NODE_ENV='production' +VUE_APP_API_BASE_URL='VUE_APP_API_BASE_URL' diff --git a/frontend/package.json b/frontend/package.json index 062964a5..d506ef06 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,6 +5,7 @@ "scripts": { "serve": "vue-cli-service serve --port=8081", "build": "vue-cli-service build", + "build:docker": "vue-cli-service build --mode docker", "lint": "vue-cli-service lint", "test": "jest" },