# syntax=docker/dockerfile:1

FROM node:19.4.0-alpine3.16

ENV DOCKERIZED=1
RUN mkdir /config
RUN chown node:node /config

RUN apk add dumb-init
ENV NODE_ENV=production
WORKDIR /app

COPY --chown=node:node . .

RUN npm ci --only=production
RUN npx tsc

RUN rm -r src/ tsconfig.json
RUN npm uninstall typescript @types/sqlite3

CMD ["dumb-init", "node", "./dist/index.js"]