-
Notifications
You must be signed in to change notification settings - Fork 7
🐳 Dockerized the project #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| node_modules | ||
| pnpm-lock.yaml | ||
| Dockerfile | ||
| .git | ||
| .gitignore | ||
| .env | ||
| *.log | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| POLAR_API_BASE_URL=https://api.polar.sh/v1 | ||
| DB_PORT=5432 | ||
| PORT=3000 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Use official Node.js LTS image | ||
| FROM node:20-alpine AS base | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Install dependencies only when needed | ||
| COPY package.json pnpm-lock.yaml ./ | ||
| RUN npm install -g pnpm && pnpm install --frozen-lockfile | ||
|
|
||
| # Copy Prisma schema and generate client | ||
| COPY prisma ./prisma | ||
| RUN pnpm exec prisma generate | ||
|
|
||
| # Copy rest of the app | ||
| COPY . . | ||
|
|
||
| # Build Next.js app | ||
| RUN pnpm build | ||
|
|
||
| # Production image | ||
| FROM node:20-alpine AS prod | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| ENV NODE_ENV=production | ||
|
|
||
| COPY --from=base /app ./ | ||
|
|
||
|
Comment on lines
+25
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Prune dev-dependencies to slim the production image. The current flow copies 🤖 Prompt for AI Agents |
||
| EXPOSE 3000 | ||
|
|
||
| CMD ["pnpm", "start"] | ||
|
Comment on lines
+21
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
FROM node:20-alpine AS prod
WORKDIR /app
ENV NODE_ENV=production
-COPY --from=base /app ./
+# Install pnpm again (tiny) or switch to `npm start`
+RUN npm install -g pnpm
+COPY --from=base /app ./Alternatively change 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| version: '3.8' | ||
|
|
||
| services: | ||
| db: | ||
| image: postgres:16-alpine | ||
| restart: always | ||
| environment: | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: postgres | ||
| POSTGRES_DB: laminarflow | ||
|
Comment on lines
+7
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid hard-coding database credentials in version-controlled compose files. Expose them via an external 🤖 Prompt for AI Agents |
||
| volumes: | ||
| - db_data:/var/lib/postgresql/data | ||
| ports: | ||
| - "${DB_PORT:-5432}:5432" | ||
|
|
||
| app: | ||
| build: . | ||
| depends_on: | ||
| - db | ||
| environment: | ||
| DATABASE_URL: postgres://postgres:postgres@db:${DB_PORT:-5432}/laminarflow | ||
| NODE_ENV: production | ||
|
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quote the Colons in unquoted scalars and the - DATABASE_URL: postgres://postgres:postgres@db:${DB_PORT:-5432}/laminarflow
+ DATABASE_URL: "postgres://postgres:postgres@db:${DB_PORT:-5432}/laminarflow"🧰 Tools🪛 Checkov (3.2.334)[MEDIUM] 21-22: Basic Auth Credentials (CKV_SECRET_4) 🤖 Prompt for AI Agents |
||
| ports: | ||
| - "${PORT:-3000}:3000" | ||
| env_file: | ||
| - .env | ||
|
|
||
| volumes: | ||
| db_data: | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pnpm-lock.yamlmust NOT be ignored – build will break.The Dockerfile explicitly copies the lock-file:
With the current ignore rule Docker won’t send
pnpm-lock.yamlto the build context, so theCOPYstep fails.🤖 Prompt for AI Agents