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 = {