Skip to content

Commit 69af0a4

Browse files
authored
Merge pull request #1 from cld2labs/develop
fix(frontend): resolve npm vulnerabilities for Trivy (picomatch, brac…
2 parents a05d0d9 + abc2454 commit 69af0a4

7 files changed

Lines changed: 310 additions & 789 deletions

File tree

backend/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ RUN pip install --no-cache-dir -r requirements.txt
1010

1111
COPY app ./app
1212

13+
RUN groupadd --gid 1000 app \
14+
&& useradd --uid 1000 --gid app --home-dir /app --no-create-home app \
15+
&& chown -R app:app /app
16+
17+
USER app
18+
1319
ENV PORT=8000
1420
EXPOSE 8000
1521

frontend/Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
# Stage 1: Dependencies — install npm packages
1+
# Stage 1: Dependencies — install npm packages (non-root)
22
FROM node:20-alpine AS deps
3+
RUN addgroup --system --gid 1001 nodejs \
4+
&& adduser --system --uid 1001 -G nodejs nextjs
35
WORKDIR /app
4-
COPY package.json package-lock.json ./
6+
COPY --chown=nextjs:nodejs package.json package-lock.json ./
7+
# WORKDIR is root-owned by default; allow nextjs to create node_modules
8+
RUN chown nextjs:nodejs /app
9+
USER nextjs
510
RUN npm ci
611

7-
# Stage 2: Builder — production build
12+
# Stage 2: Builder — production build (non-root)
813
FROM node:20-alpine AS builder
14+
RUN addgroup --system --gid 1001 nodejs \
15+
&& adduser --system --uid 1001 -G nodejs nextjs
916
WORKDIR /app
1017
ENV NODE_ENV=production
1118
ENV NEXT_TELEMETRY_DISABLED=1
12-
COPY --from=deps /app/node_modules ./node_modules
13-
COPY . .
19+
COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules
20+
COPY --chown=nextjs:nodejs . .
21+
RUN chown -R nextjs:nodejs /app
22+
USER nextjs
1423
RUN npm run build
1524

1625
# Stage 3: Runner — minimal production image
@@ -22,7 +31,7 @@ ENV PORT=3000
2231
ENV HOSTNAME=0.0.0.0
2332

2433
RUN addgroup --system --gid 1001 nodejs \
25-
&& adduser --system --uid 1001 nextjs
34+
&& adduser --system --uid 1001 -G nodejs nextjs
2635

2736
COPY --from=builder /app/public ./public
2837
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./

frontend/app/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use client";
22

33
import { useCallback, useEffect, useState } from "react";
4-
import Image from "next/image";
54
import { Loader2 } from "lucide-react";
65
import { Badge } from "@/components/ui/badge";
76
import { Card } from "@/components/ui/card";
@@ -97,13 +96,12 @@ export default function Home() {
9796
used for medical decision-making.
9897
</div>
9998
</div>
100-
<Image
99+
<img
101100
src="/logo.png"
102101
alt="Cloud2 Labs"
103102
width={140}
104103
height={50}
105104
className="shrink-0 opacity-90 transition-opacity hover:opacity-100"
106-
priority
107105
/>
108106
</header>
109107

0 commit comments

Comments
 (0)