clip / Dockerfile
Husr's picture
first commit
d988ae4
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"]