From 1ff3e7c722f7946619828043161506f2f8aba531 Mon Sep 17 00:00:00 2001 From: JianMiau Date: Mon, 26 Feb 2024 11:46:31 +0800 Subject: [PATCH] =?UTF-8?q?[mod]=20certificate=E9=80=A3=E7=B5=90=E5=88=B0?= =?UTF-8?q?=E5=85=B1=E7=94=A8=E8=AD=89=E6=9B=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 +++++- src/LineBotClass.ts | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b7093b..c669e48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ # sudo docker build -t linebotts . -# sudo docker exec -it 2e8e3995aa52 /bin/bash +# sudo docker run -v /volume1/homes/JianMiau/www/certificate:/certificate --name=linebotts --restart always --net=host linebotts +# docker ps +# sudo docker exec -it f39bfa9c0819 /bin/bash # 選擇node FROM node:19.4.0 @@ -10,6 +12,8 @@ ENV NODE_ENV=production # 指定預設/工作資料夾 WORKDIR /app +VOLUME ["/certificate"] + # 只copy package.json檔案 COPY ["package.json", "./"] diff --git a/src/LineBotClass.ts b/src/LineBotClass.ts index d329f35..6420dcc 100644 --- a/src/LineBotClass.ts +++ b/src/LineBotClass.ts @@ -28,9 +28,9 @@ export default class LineBotClass { */ constructor() { //讀取憑證及金鑰 - const prikey: string = fs.readFileSync("./certificate/RSA-privkey.pem", "utf8"); - const cert: string = fs.readFileSync("./certificate/RSA-cert.pem", "utf8"); - const cafile: string = fs.readFileSync("./certificate/RSA-chain.pem", "utf-8"); + const prikey: string = fs.readFileSync("/certificate/RSA-privkey.pem", "utf8"); + const cert: string = fs.readFileSync("/certificate/RSA-cert.pem", "utf8"); + const cafile: string = fs.readFileSync("/certificate/RSA-chain.pem", "utf-8"); //建立憑證及金鑰 const credentials: Object = {