47 lines
1.7 KiB
Docker
47 lines
1.7 KiB
Docker
FROM node:22-bookworm
|
|
|
|
ARG DEBIAN_MIRROR=mirrors.cloud.tencent.com
|
|
ARG NPM_REGISTRY=https://registry.npmmirror.com
|
|
ARG PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright
|
|
ARG UV_DEFAULT_INDEX=https://mirrors.cloud.tencent.com/pypi/simple
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
|
ENV UV_LINK_MODE=copy
|
|
ENV UV_DEFAULT_INDEX=${UV_DEFAULT_INDEX}
|
|
ENV PIP_INDEX_URL=${UV_DEFAULT_INDEX}
|
|
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
|
|
|
|
WORKDIR /app
|
|
|
|
RUN sed -i "s|http://deb.debian.org/debian|https://${DEBIAN_MIRROR}/debian|g" /etc/apt/sources.list.d/debian.sources \
|
|
&& sed -i "s|http://security.debian.org/debian-security|https://${DEBIAN_MIRROR}/debian-security|g" /etc/apt/sources.list.d/debian.sources
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends curl ca-certificates python3 python3-pip \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
|
|
&& ln -sf /root/.local/bin/uv /usr/local/bin/uv
|
|
|
|
COPY apps/backend/package.json apps/backend/package-lock.json ./
|
|
RUN npm ci
|
|
|
|
RUN if [ -n "${PLAYWRIGHT_DOWNLOAD_HOST}" ]; then \
|
|
echo "Trying Playwright mirror: ${PLAYWRIGHT_DOWNLOAD_HOST}"; \
|
|
PLAYWRIGHT_DOWNLOAD_HOST="${PLAYWRIGHT_DOWNLOAD_HOST}" npx playwright install --with-deps chromium \
|
|
|| (echo "Playwright mirror failed, falling back to official host" && npx playwright install --with-deps chromium); \
|
|
else \
|
|
npx playwright install --with-deps chromium; \
|
|
fi
|
|
|
|
COPY apps/backend/ ./
|
|
|
|
RUN uv sync --directory subservices/ocr-worker --frozen
|
|
|
|
RUN mkdir -p /app/data /app/data/browser-sessions /app/data/redeem-screenshots
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["npm", "run", "start"]
|