FROM node:20.11.1

# Create app directory
WORKDIR /usr/src/app

RUN curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.10
RUN yarn set version 1.22.19

COPY package.json yarn.lock ./

RUN yarn install

COPY . .

RUN cp .env-example .env
RUN yarn docs:bundle

EXPOSE 3030

## only for development and testing
CMD ["./docker-compose/volumes/api/wait-for-it.sh", "$POSTGRES_HOST:$POSTGRES_PORT", "--", "./docker-compose/volumes/api/wait-for-it.sh", "$REDIS_HOST:$REDIS_PORT", "--", "yarn", "start"]
