cled / Dockerfile
Clarzis's picture
Update Dockerfile
43efa33 verified
# Use the official Node.js image as the base image
FROM node:20.4
# Set the working directory in the container
WORKDIR /app
# Git clone clewd
RUN git clone https://github.com/teralomaniac/clewd.git .
RUN sed -i 's|/v1/chat|/api/v1/chat|g' /app/clewd.js && \
sed -i 's|/v1/models|/api/v1/models|g' /app/clewd.js
# RUN sed -i 's/res\.write(`<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n<script>\nfunction copyToClipboard(text) {\n var textarea = document.createElement("textarea");\n textarea.textContent = text;\n textarea.style.position = "fixed";\n document.body.appendChild(textarea);\n textarea.select();\n try {\n return document.execCommand("copy");\n } catch (ex) {\n console.warn("Copy to clipboard failed.", ex);\n return false;\n } finally {\n document.body.removeChild(textarea);\n }\n}\nfunction copyLink(event) {\n event.preventDefault();\n const url = new URL(window.location.href);\n const link = url.protocol + '//' + url.host + '/v1';\n copyToClipboard(link);\n alert('链接已复制: ' + link);\n}\n</script>\n</head>\n<body>\n${Main}<br/><br/>完全开源、免费且禁止商用<br/><br/>点击复制反向代理: <a href="v1" onclick="copyLink(event)">Copy Link</a><br/>填入OpenAI API反向代理并选择OpenAI分类中的claude模型(酒馆需打开Show "External" models,仅在api模式有模型选择差异)<br/><br/>教程与FAQ: <a href="https://rentry.org/teralomaniac_clewd" target="FAQ">Rentry</a> | <a href="https://discord.com/invite/B7Wr25Z7BZ" target="FAQ">Discord</a><br/><br/><br/>❗警惕任何高风险cookie/伪api(25k cookie)购买服务,以及破坏中文AI开源共享环境倒卖免费资源抹去署名的群组(🈲黑名单:酒馆小二、AI新服务、浅睡(鲑鱼)、赛博女友制作人(青麈/overloaded/科普晓百生)🈲)\n</body>\n</html>`); \/\//d' /app/clewd.js
RUN sed -i -E '/res\.write\(`<!DOCTYPE html>.*<\/html>`\);/d' /app/clewd.js
# Install the dependencies
RUN npm install --no-audit --fund false
# Change ownership of files in lib/bin and set permissions
RUN chown -R node:node lib/bin/* && \
chmod u+x lib/bin/* && \
chmod -R 777 /app
# Run as the "node" user for better security practices
USER node
RUN ls -la
# Start the application
CMD ["node", "clewd.js"]