FROM node:slim # Create app directory WORKDIR /app # Install dependencies from lockfile to ensure exact versions COPY package.json package-lock.json ./ RUN npm ci # Copy the rest of the source code COPY . . # Build the project from source (dist assets) RUN npm run dist # Default command: keep container alive after build and show dist contents CMD ["bash", "-lc", "echo 'Bootstrap dist built at /app/dist'; ls -la dist; echo 'Container idle. Press Ctrl+C to exit.'; tail -f /dev/null"]
node_modules dist .env .git _git site/dist site/.astro _site
node_modules dist site/dist _site .github .git npm-debug.log* yarn.lock
Concerns: The CMD uses bash -lc; ensure the base image node:slim includes bash; if bash is not installed, container startup may fail., Build relies on an existing package-lock.json for npm ci; if the lockfile is missing or out of date, the build will fail., If npm run dist fails during build, the image will end up without a dist directory; consider handling build failures gracefully. Smoke [PASS]: test -d /app/dist && ls -la /app/dist Smoke [PASS]: ls -la /app/dist | wc -l