FROM --platform=linux/amd64 node:20-alpine

WORKDIR /usr/src/app

COPY package*.json ./
COPY tsconfig*.json ./

RUN apk add --no-cache --virtual  \
    .gyp \
    python3 \
    make \
    g++  \
    cairo-dev  \
    pkgconfig  \
    pixman-dev  \
    libpng-dev  \
    jpeg-dev \
    giflib-dev \
    libjpeg-turbo-dev \
    librsvg \
    pango-dev


ENV NODE_TLS_REJECT_UNAUTHORIZED=0
RUN npm install --build-from-source
COPY . .
RUN npm run build

EXPOSE 3000



CMD [ "node", "dist/main.js" ]

