FROM node:20-slim WORKDIR /app # Install git RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* # Copy package config files COPY package*.json ./ # Install all dependencies (production & development for compilation) RUN npm install # Copy full source COPY . . # Build application (generates /dist and /dist/server.cjs) RUN npm run build # Configure default directory permissions RUN mkdir -p /app/data && chmod -R 777 /app/data # Expose Space port EXPOSE 7860 ENV PORT=7860 ENV NODE_ENV=production # Start container CMD ["npm", "run", "start"]