FROM node:18-slim RUN apt-get update && apt-get install -y openssl RUN yarn global add pnpm WORKDIR /app # Install dependencies based on the preferred package manager COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ RUN pnpm install COPY src ./src COPY components ./components COPY pages ./pages COPY prisma ./prisma COPY styles ./styles COPY public ./public COPY *.config.js ./ COPY tsconfig.json ./ COPY next-*.d.ts ./ # Environment variables must be present at build time # https://github.com/vercel/next.js/discussions/14030 ARG KEYCLOAK_ID ENV KEYCLOAK_ID=${KEYCLOAK_ID} ARG KEYCLOAK_SECRET ENV KEYCLOAK_SECRET=${KEYCLOAK_SECRET} ARG KEYCLOAK_ISSUER ENV KEYCLOAK_ISSUER=${KEYCLOAK_ISSUER} ARG DISCORD_CLIENT_ID ENV DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID} ARG DISCORD_CLIENT_SECRET ENV DISCORD_CLIENT_SECRET=${DISCORD_CLIENT_SECRET} ARG GITHUB_CLIENT_ID ENV GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID} ARG GITHUB_CLIENT_SECRET ENV GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET} ARG AUDIT_WEBHOOK ENV AUDIT_WEBHOOK=${AUDIT_WEBHOOK} ARG MEILISEARCH_URL ENV MEILISEARCH_URL=${MEILISEARCH_URL} ARG NEXT_PUBLIC_MEILISEARCH_URL ENV NEXT_PUBLIC_MEILISEARCH_URL=${NEXT_PUBLIC_MEILISEARCH_URL} ARG MEILISEARCH_KEY ENV MEILISEARCH_KEY=${MEILISEARCH_KEY} ARG NEXT_PUBLIC_MEILISEARCH_SEARCH_KEY ENV NEXT_PUBLIC_MEILISEARCH_SEARCH_KEY=${NEXT_PUBLIC_MEILISEARCH_SEARCH_KEY} ARG NEXTAUTH_URL ENV NEXTAUTH_URL=${NEXTAUTH_URL} ARG NEXTAUTH_SECRET ENV NEXTAUTH_SECRET=${NEXTAUTH_SECRET} ENV DATABASE_URL="file:/data/database.db" ENV NEXT_TELEMETRY_DISABLED 1 RUN pnpm prisma generate RUN pnpm build COPY entry.sh ./ CMD ./entry.sh