|
|
|
|
|
FROM node:20-bullseye AS builder |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
RUN corepack enable && corepack prepare pnpm@9.0.0 --activate |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
ARG FIRECRAWL_REPO=https://github.com/mendableai/firecrawl.git |
|
|
RUN git clone --depth=1 ${FIRECRAWL_REPO} . |
|
|
|
|
|
|
|
|
RUN pnpm install --frozen-lockfile |
|
|
|
|
|
WORKDIR /app/apps/playwright-service |
|
|
RUN pnpm build |
|
|
|
|
|
WORKDIR /app/apps/api |
|
|
RUN pnpm build |
|
|
|
|
|
|
|
|
FROM node:20-bullseye |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
|
wget gnupg ca-certificates fonts-liberation libasound2 \ |
|
|
libatk1.0-0 libatk-bridge2.0-0 libatspi2.0-0 libcups2 libdbus-1-3 \ |
|
|
libdrm2 libgtk-3-0 libnspr4 libnss3 libxcomposite1 libxdamage1 \ |
|
|
libxfixes3 libxkbcommon0 libxrandr2 xdg-utils libpango-1.0-0 \ |
|
|
libxcursor1 libxi6 libxrender1 libxtst6 libjpeg62-turbo \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
ENV NODE_ENV=production |
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
COPY --from=builder /app /app |
|
|
|
|
|
|
|
|
RUN npx playwright install chromium && npx playwright install-deps |
|
|
|
|
|
|
|
|
RUN printf '#!/usr/bin/env bash\nset -e\n\ |
|
|
export PORT=${PORT:-7860}\n\ |
|
|
export HOST=${HOST:-0.0.0.0}\n\ |
|
|
# Bạn tự set các ENV khác trong Space Settings: USE_DB_AUTHENTICATION, REDIS_URL, v.v.\n\ |
|
|
export PLAYWRIGHT_MICROSERVICE_URL=${PLAYWRIGHT_MICROSERVICE_URL:-http://127.0.0.1:3000/html}\n\ |
|
|
node /app/apps/playwright-service/dist/index.js &\n\ |
|
|
node /app/apps/api/dist/main.js\n' > /app/run.sh && chmod +x /app/run.sh |
|
|
|
|
|
EXPOSE 7860 |
|
|
CMD ["/app/run.sh"] |