diff --git a/apps/hub/Dockerfile b/apps/hub/Dockerfile index 3ad34206..7c402f9f 100644 --- a/apps/hub/Dockerfile +++ b/apps/hub/Dockerfile @@ -1,29 +1,48 @@ -FROM node:22-alpine +FROM node:22-alpine AS base + +ENV PNPM_HOME="/usr/local/pnpm" +ENV PATH="${PNPM_HOME}:${PATH}" +RUN corepack enable && corepack prepare pnpm@latest --activate + +RUN pnpm add -g turbo@^2.5 + +FROM base AS builder +RUN apk update +RUN apk add --no-cache libc6-compat -# Set the working directory WORKDIR /usr/app -# Copy package.json and package-lock.json -COPY package*.json ./ - -# Install dependencies -RUN npm install - -# Change ownership to the non-root user -RUN chown -R node:node /usr/app - -# Copy the rest of the application code COPY . . -# Build the application -RUN npm run build +RUN turbo prune hub --docker + +FROM base AS installer +RUN apk update +RUN apk add --no-cache libc6-compat + +WORKDIR /usr/app + +COPY --from=builder /usr/app/out/json/ . +RUN pnpm install --frozen-lockfile + +# Build the project +COPY --from=builder /usr/app/out/full/ . + +RUN turbo run build + +FROM base AS runner +WORKDIR /usr/app + +# Don't run production as root +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs +USER nextjs + +# Automatically leverage output traces to reduce image size +# https://nextjs.org/docs/advanced-features/output-file-tracing +COPY --from=installer --chown=nextjs:nodejs /usr/app/ ./ # Expose the application port EXPOSE 3000 -# Run container as non-root (unprivileged) user -# The "node" user is provided in the Node.js Alpine base image -USER node - -# Command to run the application -CMD ["npm", "start"] \ No newline at end of file +CMD ["pnpm", "--dir", "apps/hub", "run", "start"] \ No newline at end of file diff --git a/apps/hub/package.json b/apps/hub/package.json index db52032b..30068323 100644 --- a/apps/hub/package.json +++ b/apps/hub/package.json @@ -11,6 +11,7 @@ "dependencies": { "@hookform/resolvers": "^4.1.3", "@next-auth/prisma-adapter": "^1.0.7", + "@radix-ui/react-icons": "^1.3.2", "@repo/db": "*", "@tanstack/react-query": "^5.67.2", "@tanstack/react-table": "^8.20.6", @@ -40,6 +41,8 @@ }, "devDependencies": { "@eslint/eslintrc": "^3", + "@repo/eslint-config": "*", + "@repo/typescript-config": "*", "@tailwindcss/postcss": "^4.0.8", "@types/bcryptjs": "^2.4.6", "@types/jsonwebtoken": "^9.0.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d69b54a9..32073e91 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -232,6 +232,9 @@ importers: '@next-auth/prisma-adapter': specifier: ^1.0.7 version: 1.0.7(@prisma/client@6.8.2(prisma@6.8.2(typescript@5.8.3))(typescript@5.8.3))(next-auth@4.24.11(next@15.3.2(@babel/core@7.27.1)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(nodemailer@6.10.1)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)) + '@radix-ui/react-icons': + specifier: ^1.3.2 + version: 1.3.2(react@19.1.0) '@repo/db': specifier: '*' version: link:../../packages/database @@ -314,6 +317,12 @@ importers: '@eslint/eslintrc': specifier: ^3 version: 3.3.1 + '@repo/eslint-config': + specifier: '*' + version: link:../../packages/eslint-config + '@repo/typescript-config': + specifier: '*' + version: link:../../packages/typescript-config '@tailwindcss/postcss': specifier: ^4.0.8 version: 4.1.7 diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..e69de29b