[Snow Team] Merge dev-docker's work
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
# Dev Dockerfile — single-stage, root, VNC/X11 + Playwright + OCR
|
||||||
|
# For production, see backend.Dockerfile (multi-stage build)
|
||||||
|
FROM node:22-bookworm
|
||||||
|
|
||||||
|
ARG DEBIAN_MIRROR=mirrors.cloud.tencent.com
|
||||||
|
ARG NPM_REGISTRY=https://registry.npmmirror.com
|
||||||
|
ARG UV_INDEX_URL=https://mirrors.cloud.tencent.com/pypi/simple
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
ENV TZ=Asia/Shanghai
|
||||||
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||||
|
ENV PIP_INDEX_URL=${UV_INDEX_URL}
|
||||||
|
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
|
sed -i "s|http://deb.debian.org/debian|http://${DEBIAN_MIRROR}/debian|g" /etc/apt/sources.list.d/debian.sources \
|
||||||
|
&& sed -i "s|http://security.debian.org/debian-security|http://${DEBIAN_MIRROR}/debian-security|g" /etc/apt/sources.list.d/debian.sources \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
curl ca-certificates python3 python3-pip tzdata \
|
||||||
|
xauth x11vnc novnc websockify xvfb \
|
||||||
|
&& ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
||||||
|
&& echo ${TZ} > /etc/timezone
|
||||||
|
|
||||||
|
COPY apps/backend/package.json apps/backend/package-lock.json ./
|
||||||
|
RUN --mount=type=cache,target=/root/.npm npm ci
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/ms-playwright-cache,sharing=locked \
|
||||||
|
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright-cache \
|
||||||
|
PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright/ \
|
||||||
|
npx playwright install --with-deps chromium \
|
||||||
|
&& cp -r /ms-playwright-cache /ms-playwright
|
||||||
|
|
||||||
|
COPY apps/backend/subservices/ocr-worker/ ./subservices/ocr-worker/
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
|
||||||
|
python3 -m pip install --break-system-packages ./subservices/ocr-worker
|
||||||
|
|
||||||
|
COPY apps/backend/ ./
|
||||||
|
|
||||||
|
RUN mkdir -p /app/data /app/data/browser-sessions /app/data/redeem-screenshots
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["npm", "run", "start"]
|
||||||
@@ -10,7 +10,11 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "${POSTGRES_PORT:-5432}:5432"
|
- "${POSTGRES_PORT:-5432}:5432"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-order_site}"]
|
test:
|
||||||
|
[
|
||||||
|
"CMD-SHELL",
|
||||||
|
"pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-order_site}",
|
||||||
|
]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 20
|
retries: 20
|
||||||
@@ -20,7 +24,7 @@ services:
|
|||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: deploy/docker/backend.Dockerfile
|
dockerfile: deploy/docker/backend-dev.Dockerfile
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
@@ -30,7 +34,8 @@ services:
|
|||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:3000/health/ready || exit 1"]
|
test:
|
||||||
|
["CMD-SHELL", "curl -fsS http://127.0.0.1:3000/health/ready || exit 1"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|||||||
Reference in New Issue
Block a user