# syntax=docker/dockerfile:1.4
FROM node:18-alpine

WORKDIR /app

RUN apk add --no-cache tini wget

COPY package.json yarn.lock ./

ENV NODE_ENV=production

RUN yarn install --frozen-lockfile --production --non-interactive

COPY src ./src
COPY data ./data

EXPOSE 8082

HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
  CMD wget -q -O /dev/null http://127.0.0.1:8082/health || exit 1

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "src/index.js"]
