From 5595eb3e0b7e8bb7a7ff13e142cd9dde637cbd81 Mon Sep 17 00:00:00 2001 From: song_jx <1649991905@qq.com> Date: Thu, 19 Jan 2023 15:13:27 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ README.md | 26 ++++++++++++++++++++++++++ docker-compose.yml | 10 ++++++++++ entrypoint.sh | 13 +++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c431196 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +FROM node:alpine3.17 + +# 项目地址(国内加速) +ARG gitUrl="https://ghproxy.com/https://github.com/nn200433/qilindrop.git" + +# 定义环境变量 +ENV TZ=Asia/Shanghai +ENV PORT=3000 +ENV OPTIONS= + +# 安装一些常用组件 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \ + apk add -U --no-cache \ + ca-certificates \ + bash \ + curl \ + git \ + openssh \ + tzdata && \ + cp /usr/share/zoneinfo/${TZ} /etc/localtime && \ + echo ${TZ} > /etc/timezone && \ + apk del tzdata && \ + mkdir -p /home + +# 下载项目 +RUN cd /home && \ + git clone --depth=1 "${gitUrl}" && \ + cd qilindrop && chmod +x entrypoint.sh + +# 编译项目 +RUN cd /home/qilindrop && \ + npm config set registry https://registry.npm.taobao.org && \ + # npm install -g pm2 && \ + npm install + +# 指定默认工作目录 +WORKDIR /home/qilindrop + +# 默认3000端口 +EXPOSE 3000/tcp + +ENTRYPOINT ["/home/qilindrop/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index da6c169..29c7328 100755 --- a/README.md +++ b/README.md @@ -15,3 +15,29 @@ Make sure to check your ip address using your OS command. By default, it is used inside the LAN.\ Users who are not in the same LAN can establish a connection by entering the same room name.\ Enter a blank room name to return to LAN mode. + +## How to use Docker + +docker + +```bash +docker run -itd --name=snapdrop --net=host --restart=unless-stopped -e PORT=5000 -e OPTIONS=public nn200433/snapdrop:latest +``` + +docker-compose + +```yml +version: '3' +services: + snapdrop: + image: nn200433/snapdrop:latest + container_name: snapdrop + restart: unless-stopped + network_mode: host + environment: + # Ĭ3000 + - PORT=5000 + - TZ=Asia/Shanghai + # Ĭ + - OPTIONS=public +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..868680f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' +services: + snapdrop: + image: nn200433/snapdrop:1.0 + container_name: snapdrop + restart: unless-stopped + network_mode: host + environment: + - TZ=Asia/Shanghai + - OPTIONS=public \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..755a992 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# 启动传送 +if [ -n "${OPTIONS}" ]; then + echo "即将启动传送..." + echo "参数:OPTIONS = ${OPTIONS}" + #exec pm2 start index.js -- ${OPTIONS} + exec node index.js -- ${OPTIONS} +else + echo "即将启动传送..." + #exec pm2 start index.js + node index.js +fi \ No newline at end of file From bbd579ee8bc541e41798f4782f2d9f9c8d6f01f5 Mon Sep 17 00:00:00 2001 From: song_jx <1649991905@qq.com> Date: Thu, 19 Jan 2023 15:14:24 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E9=80=9F?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c431196..0371c7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM node:alpine3.17 # 项目地址(国内加速) -ARG gitUrl="https://ghproxy.com/https://github.com/nn200433/qilindrop.git" +ARG gitUrl="https://ghproxy.com/https://github.com/nn200433/snapdrop.git" # 定义环境变量 ENV TZ=Asia/Shanghai From 87bc67a046955b2427ba61fc919e3187ad59ee0b Mon Sep 17 00:00:00 2001 From: song_jx <1649991905@qq.com> Date: Thu, 19 Jan 2023 15:15:22 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0371c7a..8325abf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,18 +25,18 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositorie # 下载项目 RUN cd /home && \ git clone --depth=1 "${gitUrl}" && \ - cd qilindrop && chmod +x entrypoint.sh + cd snapdrop && chmod +x entrypoint.sh # 编译项目 -RUN cd /home/qilindrop && \ +RUN cd /home/snapdrop && \ npm config set registry https://registry.npm.taobao.org && \ # npm install -g pm2 && \ npm install # 指定默认工作目录 -WORKDIR /home/qilindrop +WORKDIR /home/snapdrop # 默认3000端口 EXPOSE 3000/tcp -ENTRYPOINT ["/home/qilindrop/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/home/snapdrop/entrypoint.sh"] \ No newline at end of file From 40538c641c8c1203f8039949848aed4c40c92752 Mon Sep 17 00:00:00 2001 From: song_jx <1649991905@qq.com> Date: Thu, 19 Jan 2023 15:23:29 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BAutf8=E7=BC=96?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 29c7328..f472cb9 100755 --- a/README.md +++ b/README.md @@ -18,13 +18,13 @@ Enter a blank room name to return to LAN mode. ## How to use Docker -docker +docker: ```bash docker run -itd --name=snapdrop --net=host --restart=unless-stopped -e PORT=5000 -e OPTIONS=public nn200433/snapdrop:latest ``` -docker-compose +docker-compose: ```yml version: '3' @@ -35,9 +35,9 @@ services: restart: unless-stopped network_mode: host environment: - # Ĭ3000 + # 默认3000 - PORT=5000 - TZ=Asia/Shanghai - # Ĭ + # 默认内网 - OPTIONS=public ``` \ No newline at end of file From b7efe0d24564ef7e4946908f1083c08fa7aef134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=8E=E9=9A=BC=E4=B8=B6=E6=AD=A2=E6=88=88?= <1649991905@qq.com> Date: Tue, 24 Jan 2023 01:13:03 +0800 Subject: [PATCH 5/5] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f472cb9..d77a724 100755 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ services: restart: unless-stopped network_mode: host environment: - # 默认3000 - - PORT=5000 + # 默认3000 + - PORT=5000 - TZ=Asia/Shanghai - # 默认内网 + # 默认内网 - OPTIONS=public -``` \ No newline at end of file +```