[mod] certificate連結到共用證書

This commit is contained in:
建喵 2024-02-26 11:46:31 +08:00
parent 38d4f5e432
commit 1ff3e7c722
2 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,7 @@
# sudo docker build -t linebotts . # 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 # 選擇node
FROM node:19.4.0 FROM node:19.4.0
@ -10,6 +12,8 @@ ENV NODE_ENV=production
# 指定預設/工作資料夾 # 指定預設/工作資料夾
WORKDIR /app WORKDIR /app
VOLUME ["/certificate"]
# 只copy package.json檔案 # 只copy package.json檔案
COPY ["package.json", "./"] COPY ["package.json", "./"]

View File

@ -28,9 +28,9 @@ export default class LineBotClass {
*/ */
constructor() { constructor() {
//讀取憑證及金鑰 //讀取憑證及金鑰
const prikey: string = fs.readFileSync("./certificate/RSA-privkey.pem", "utf8"); const prikey: string = fs.readFileSync("/certificate/RSA-privkey.pem", "utf8");
const cert: string = fs.readFileSync("./certificate/RSA-cert.pem", "utf8"); const cert: string = fs.readFileSync("/certificate/RSA-cert.pem", "utf8");
const cafile: string = fs.readFileSync("./certificate/RSA-chain.pem", "utf-8"); const cafile: string = fs.readFileSync("/certificate/RSA-chain.pem", "utf-8");
//建立憑證及金鑰 //建立憑證及金鑰
const credentials: Object = { const credentials: Object = {