# Use official Node.js 22 on Alpine as base
FROM node:22.22.3-alpine3.23
# Create app directory
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm ci
# Copy the rest of the source code
COPY . .
# Build (if a build script exists; it's effectively a no-op for this project)
RUN npm run build --if-present
# Default command to verify the library can be loaded
CMD ["node", "-e", "console.log('passport-jwt container image ready'); require('./lib/index.js');"]
# Ignore node_modules and logs for build context node_modules/ dist/ .idea/ .vscode/ .env coverage/ *.log
# Ignore node_modules and logs for build context node_modules/ dist/ .idea/ .vscode/ .env coverage/ *.log
Smoke [FAIL]: node -e \"require('./lib/index.js'); console.log('ok')\
Output: sh: syntax error: unexpected "("# Use official Node.js 22 on Alpine as base
FROM node:22.22.3-alpine3.23
# Create app directory
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm ci
# Copy the rest of the source code
COPY . .
# Build (if a build script exists; it's effectively a no-op for this project)
RUN npm run build --if-present
# Default command: just print a ready message to verify the image loads
CMD ["node", "-e", "console.log('passport-jwt container image ready')"]
Concerns: The image currently uses a readiness message as CMD; for a library image this is acceptable but provides no runtime health check beyond loading Node. Consider adding a light healthcheck or a tiny smoke task that exercises the library functionality., npm ci will install devDependencies by default unless a lockfile indicates otherwise; if a minimal production image is desired, consider using npm ci --omit=dev or similar to reduce image size. Smoke [PASS]: npm test --silent