-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
50 lines (37 loc) · 1.05 KB
/
Copy pathDockerfile.dev
File metadata and controls
50 lines (37 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Development Dockerfile for SearchBox App
FROM node:18-bullseye-slim
# Install build dependencies for native modules
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
cmake \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container
WORKDIR /app
# Install pnpm globally
RUN npm install -g pnpm
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml* ./
# Install dependencies (including dev dependencies) with rebuild for native modules
RUN pnpm install
# Force rebuild faiss-node for the container architecture
RUN pnpm rebuild faiss-node
# General rebuild for other native modules
RUN pnpm rebuild
# Copy the rest of the application code
COPY . .
# Create a non-root user for security
RUN groupadd -g 1001 nodejs
RUN useradd -r -u 1001 -g nodejs nextjs
RUN chown nextjs:nodejs /app
USER nextjs
# Expose the port that the app runs on
EXPOSE 3000
# Set environment variables
ENV NODE_ENV=development
ENV PORT=3000
# Start the development server
CMD ["pnpm", "dev"]