File tree Expand file tree Collapse file tree 1 file changed +6
-29
lines changed
Expand file tree Collapse file tree 1 file changed +6
-29
lines changed Original file line number Diff line number Diff line change 1- # ----------- Build Stage -----------
2- FROM oven/bun:1 AS build
3-
4- WORKDIR /app
5-
6- # Copy only the lockfile and package manifest first for better caching
7- COPY autoproject/package.json autoproject/bun.lockb* ./
8-
9- # Install dependencies with strict lockfile
10- RUN bun install --frozen-lockfile --no-progress
11-
12- # Copy the rest of the source code
13- COPY autoproject/ ./
14-
15- # Build your app
16- RUN bun run build
17-
18- # ----------- Production Stage -----------
191FROM oven/bun:1-slim AS production
202
21- # Create a non-root user
3+ RUN apt-get update \
4+ && apt-get install -y --no-install-recommends adduser \
5+ && rm -rf /var/lib/apt/lists/*
6+
227RUN adduser --disabled-password --gecos "" appuser
238
249WORKDIR /app
2510
26- # Copy only the necessary artifacts
2711COPY --from=build /app/build ./build
2812COPY --from=build /app/package.json ./
29- COPY --from=build /app/node_modules ./node_modules
3013
31- # Environment variables
14+ RUN bun install --production --no-progress
15+
3216ENV NODE_ENV=production
3317ENV PORT=3000
3418ENV HOST=0.0.0.0
3519
36- # Switch to non-root user
3720USER appuser
38-
39- # Expose the port
4021EXPOSE 3000
4122
42- # Optional: health check (uncomment and customize if needed)
43- # HEALTHCHECK --interval=30s --timeout=5s --start-period=5s CMD curl -f http://localhost:3000/health || exit 1
44-
45- # Start the app
4623CMD ["bun" , "build/index.js" ]
You can’t perform that action at this time.
0 commit comments