# Use a slim, Debian-based Node.js runtime for better compatibility FROM node:18-slim # Set the working directory in the container WORKDIR /usr/src/app # Copy package.json and package-lock.json to leverage Docker's layer caching COPY package*.json ./ # Install app dependencies RUN npm install --omit=dev # Copy all project files, including the 'public' directory, into the container COPY . . # Bake a cache-busting version into the service worker ARG APP_VERSION=dev RUN sed -i "s/__APP_VERSION__/${APP_VERSION}/g" public/sw.js # Make port 3000 available EXPOSE 3000 # Define the command to run your app CMD [ "node", "server.js" ]