From 09ace25ced48fe8d2e84de98121b73ab28743290 Mon Sep 17 00:00:00 2001 From: songxingguo Date: Wed, 12 Jun 2024 17:17:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20docker=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/.vuepress/public/demo/FileUpload/.dockerignore | 4 ++++ src/.vuepress/public/demo/FileUpload/BigFileUpload.html | 7 ++++--- src/.vuepress/public/demo/FileUpload/Dockerfile | 6 ++++++ src/.vuepress/public/demo/FileUpload/publish.sh | 3 +++ 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 src/.vuepress/public/demo/FileUpload/.dockerignore create mode 100644 src/.vuepress/public/demo/FileUpload/Dockerfile create mode 100755 src/.vuepress/public/demo/FileUpload/publish.sh diff --git a/src/.vuepress/public/demo/FileUpload/.dockerignore b/src/.vuepress/public/demo/FileUpload/.dockerignore new file mode 100644 index 00000000..59869d01 --- /dev/null +++ b/src/.vuepress/public/demo/FileUpload/.dockerignore @@ -0,0 +1,4 @@ + +.git +node_modules +npm-debug.log \ No newline at end of file diff --git a/src/.vuepress/public/demo/FileUpload/BigFileUpload.html b/src/.vuepress/public/demo/FileUpload/BigFileUpload.html index 3d1932c6..b7a4e098 100644 --- a/src/.vuepress/public/demo/FileUpload/BigFileUpload.html +++ b/src/.vuepress/public/demo/FileUpload/BigFileUpload.html @@ -26,6 +26,7 @@ fileSize = 0, fileChunkListData = [], abortControllerList = []; + const HOST = "http://docker.songxingguo.com"; // 切换按钮状态 const toggleBtn = (isPause = true) => { const pauseBtn = document.getElementById("pause"); @@ -181,7 +182,7 @@ }) .map(async ({ formData, hash }) => { return requestApi({ - url: `http://localhost:3000`, + url: `${HOST}`, method: "POST", body: formData, onProgress: ({ loaded, total }) => { @@ -217,7 +218,7 @@ // 合并分片 const mergeRequest = async (fileName, fileHash) => { await requestApi({ - url: "http://localhost:3000/merge", + url: `${HOST}/merge`, method: "POST", headers: { "Content-Type": "application/json;charset=utf-8", @@ -232,7 +233,7 @@ //文件秒传 const verifyUpload = async (filename, fileHash) => { const data = await requestApi({ - url: "http://localhost:3000/verify", + url: `${HOST}/verify"`, method: "POST", headers: { "Content-Type": "application/json;charset=utf-8", diff --git a/src/.vuepress/public/demo/FileUpload/Dockerfile b/src/.vuepress/public/demo/FileUpload/Dockerfile new file mode 100644 index 00000000..f1ce3dbb --- /dev/null +++ b/src/.vuepress/public/demo/FileUpload/Dockerfile @@ -0,0 +1,6 @@ +FROM node:20.12.1 +COPY . /app +WORKDIR /app +RUN npm install --registry=https://registry.npm.taobao.org +EXPOSE 3000 +CMD node server.js \ No newline at end of file diff --git a/src/.vuepress/public/demo/FileUpload/publish.sh b/src/.vuepress/public/demo/FileUpload/publish.sh new file mode 100755 index 00000000..4c75458a --- /dev/null +++ b/src/.vuepress/public/demo/FileUpload/publish.sh @@ -0,0 +1,3 @@ +docker login --username=18983642737 registry.cn-shanghai.aliyuncs.com +docker build . --file Dockerfile --tag registry.cn-shanghai.aliyuncs.com/songxingguo/bigfileupload:latest +docker push registry.cn-shanghai.aliyuncs.com/songxingguo/bigfileupload:latest \ No newline at end of file