FROM node:22-bookworm-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ openssl \ && rm -rf /var/lib/apt/lists/* # In prebuilt mode, we expect node_modules to be partially there or we use the standalone's ones # Actually, the artifact has node_modules/.prisma etc. but not the full node_modules. # However, the standalone folder HAS node_modules. # But we need tsx and socket.io. # So we still need a minimal npm install or just use the pre-installed ones if we can. # Let's keep it simple: if it's prebuilt, we just copy what we need. # But tsx is a devDependency. # Better to just use the full Dockerfile.socket for now as it's more reliable. # "tsx" is not in the standalone output. # Wait, I can just use the same strategy as memento-note: # if ARTIFACT_TGZ is present, we already tar'ed the files. # But we still need to run them. COPY socket-server.ts ./ COPY tsconfig.json ./ COPY package.json package-lock.json* ./ # We still need to install dependencies because standalone doesn't have all of them (like tsx) RUN npm install --only=production && npm install tsx ENV NODE_ENV=production ENV SOCKET_PORT=3002 ENV SOCKET_HTTP_PORT=3003 CMD ["npx", "tsx", "socket-server.ts"]