1FROM node:iron
2RUN npm install -g pnpm@9.1.0
3WORKDIR /usr/src/app
4RUN ls
5SHELL ["/bin/bash", "--login", "-c"]
6ENV SHELL bash
7COPY . .
8RUN mkdir -p /.cache/pnpm/dlx
9RUN chmod 777 /.cache/pnpm/dlx/ -R
10RUN mkdir -p /usr/src/app/.next/cache/fetch-cache
11RUN chmod 777 /usr/src/app/.next/cache -R
12RUN chmod 777 /usr/src/app -R
13RUN chmod 744 ./prisma/schema.prisma
14RUN pnpm install
15RUN pnpm dlx prisma generate
16
17# Skip the db push if it is the github actions running
18ARG BUILD_ENV=default
19ENV BUILD_ENV=${BUILD_ENV}
20RUN if [ "$BUILD_ENV" != "github" ]; then pnpm dlx prisma db push; fi
21
22RUN apt-get update && apt-get install -y git && apt-get clean
23RUN export GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
24RUN export GIT_COMMIT=$(git rev-parse --short HEAD)
25RUN rm -rf .git
26RUN pnpm build
27CMD ["pnpm", "start"]