# Auto-generated by Shiplet
# Runtime: podman  (rootless-compatible)
#
# Podman-specific notes:
#   - No USER instruction needed for rootless — Podman maps the host uid automatically
#   - HEALTHCHECK directive is respected by podman compose
#   - Build with: podman build -t shiplet-fastify/app .
ARG NODE_VERSION=22
FROM node:${NODE_VERSION}-bookworm-slim

ARG PACKAGE_MANAGER=npm
ARG TZ=UTC
ENV TZ=${TZ}
ENV DEBIAN_FRONTEND=noninteractive
# Podman rootless — ensure node_modules are writable
ENV NPM_CONFIG_CACHE=/tmp/.npm

RUN apt-get update -y \
    && apt-get install -y --no-install-recommends \
    curl git ca-certificates tzdata \
    && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
    && echo "$TZ" > /etc/timezone \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# pino-pretty for readable dev logs
RUN npm install -g pino-pretty

WORKDIR /var/www/html

HEALTHCHECK --interval=15s --timeout=5s --retries=3 \
    CMD curl -f http://localhost:3000/health || exit 1

CMD ["node", "src/index.js"]
