no-name-here commited on
Commit
bce7526
·
verified ·
1 Parent(s): a1184c2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -5
Dockerfile CHANGED
@@ -1,21 +1,29 @@
1
  FROM node:18-alpine
2
 
3
- # Create app dir
4
  WORKDIR /app
5
 
6
- # Add user
7
  RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
8
 
 
9
  COPY package*.json ./
10
  RUN npm install
11
 
 
12
  COPY . .
13
 
14
- # Build and move config to writable /tmp
15
- RUN npm run build:config && mkdir -p /tmp/vite-config && cp build-config/vite.config.js /tmp/vite-config/vite.config.js
16
 
17
- # Use non-root user
 
 
 
18
  USER nextjs
19
 
 
20
  EXPOSE 7860
 
 
21
  CMD ["npm", "run", "dev"]
 
1
  FROM node:18-alpine
2
 
3
+ # Create app directory
4
  WORKDIR /app
5
 
6
+ # Create non-root user
7
  RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
8
 
9
+ # Copy package files and install dependencies
10
  COPY package*.json ./
11
  RUN npm install
12
 
13
+ # Copy full project source
14
  COPY . .
15
 
16
+ # Copy static Vite config to a writable location
17
+ COPY temp-config/vite.config.mjs /tmp/vite.config.mjs
18
 
19
+ # Ensure correct permissions for runtime user
20
+ RUN chown -R nextjs:nodejs /app && chown -R nextjs:nodejs /tmp/vite.config.mjs
21
+
22
+ # Switch to non-root user
23
  USER nextjs
24
 
25
+ # Expose Vite dev port
26
  EXPOSE 7860
27
+
28
+ # Start Vite using the .mjs config from writable /tmp
29
  CMD ["npm", "run", "dev"]