File size: 1,279 Bytes
d988ae4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM node:20-bookworm

# Install runtime dependencies for the Space: nginx for proxying websockets and redis-server for storage
RUN apt-get update \ 
  && apt-get install -y --no-install-recommends nginx redis-server gettext-base \ 
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Enable pnpm
ENV PNPM_HOME=/root/.local/share/pnpm
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable && corepack prepare pnpm@10.11.0 --activate

# Copy manifests first for better caching
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY apps/backend/package.json apps/backend/pnpm-lock.yaml ./apps/backend/
COPY apps/frontend/package.json apps/frontend/pnpm-lock.yaml ./apps/frontend/

# Install dependencies for all workspaces
RUN pnpm install --frozen-lockfile

# Copy the rest of the source
COPY . .

# Build the applications with sensible defaults for local communication
ENV NODE_ENV=production \
    DOCKER_BACKEND_URL=http://127.0.0.1:3001 \
    NEXT_PUBLIC_URL=http://127.0.0.1:7860 \
    PUBLIC_SOCKET_URL=

RUN pnpm --filter @myclipboard.online/backend build \
  && pnpm --filter @myclipboard.online/frontend build

# Clean up nginx defaults
RUN rm -f /etc/nginx/sites-enabled/default /etc/nginx/sites-available/default || true

EXPOSE 7860

CMD ["bash", "deploy/hf/start.sh"]