Iza / Dockerfile
caarleexx's picture
Update Dockerfile
7f3a62d verified
raw
history blame
1.28 kB
FROM node:20-slim
WORKDIR /app
# 1. Instala Git e libcurl (Essenciais)
RUN apt-get update && apt-get install -y git libcurl4
# 2. Clona o repositório
RUN git clone https://github.com/huggingface/chat-ui .
# 3. Copia o .env
COPY .env .
# 4. Instala Dependências
RUN npm ci
# 5. Cria o adaptador (Corrige o erro __dirname)
RUN printf "import { fileURLToPath } from 'url';\n\
import { dirname } from 'path';\n\
const __filename = fileURLToPath(import.meta.url);\n\
const __dirname = dirname(__filename);\n\
global.__dirname = __dirname;\n\
global.__filename = __filename;\n\
import('./build/index.js');" > adapter.js
# 6. Configuração de Build
ENV OPENAI_BASE_URL="https://api.groq.com/openai/v1"
ENV NODE_OPTIONS="--max-old-space-size=4096"
# 7. Build
RUN OPENAI_API_KEY=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 npm run build
# 8. Configuração de Execução
ENV NODE_OPTIONS=""
ENV PORT=7860
ENV ADDRESS=0.0.0.0
EXPOSE 7860
# 9. INICIALIZAÇÃO COM ENDEREÇO FIXO
# Eu construí o endereço baseado no seu usuário (caarleexx) e space (iza)
# O Hugging Face usa o padrão: https://usuario-nomedospace.hf.space
CMD ["sh", "-c", "ORIGIN=https://caarleexx-iza.hf.space OPENAI_API_KEY=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 node adapter.js"]