FROM node:22
WORKDIR /app
RUN corepack enable
COPY package.json yarn.lock .yarnrc.yml ./
RUN apt update && apt install --yes python3 python3-pip build-essential
RUN yarn set version latest
RUN yarn install --frozen-lockfile
COPY . .

ENV PORT=80
ENV CORS_ORIGIN=chad.koptilnya.xyz
ENV ANNOUNCED_ADDRESS=91.144.171.182

RUN yarn db:deploy

EXPOSE 80

CMD ["yarn", "start"]
