Dockerfile (584B)
1 # Use a lightweight Node.js image 2 FROM node:20-alpine 3 4 # Set working directory 5 WORKDIR /app 6 7 # Copy package files first to leverage Docker cache 8 COPY package*.json ./ 9 10 # Install dependencies 11 RUN npm ci --only=production 12 13 # Copy the rest of the application code 14 COPY . . 15 16 # Create the data directory so permissions can be set if needed 17 # (Though server.js creates it if missing, doing it here ensures the volume mount point exists) 18 RUN mkdir -p data 19 20 ENV PORT=3000 21 22 # Expose the default port 23 EXPOSE ${PORT} 24 25 # persist data 26 VOLUME ["/app/data"] 27 28 # Start the server 29 CMD ["npm", "start"]