FROM node:20-alpine AS runner

ENV NODE_ENV=production
ENV PORT=18103
ENV MAP_CACHE_DIR=/var/lib/nodedc-map-cache

WORKDIR /app

RUN apk add --no-cache su-exec

COPY package.json ./
COPY src ./src
COPY zone-sources ./zone-sources
COPY runtime-entrypoint.mjs /app/runtime-entrypoint.mjs

EXPOSE 18103

ENTRYPOINT ["node", "/app/runtime-entrypoint.mjs"]
CMD ["node", "src/server.mjs"]
