jurmy24 commited on
Commit
c83b086
·
1 Parent(s): 2e1381e

get rid of nginx use

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -17
Dockerfile CHANGED
@@ -1,28 +1,32 @@
1
- FROM node:18-alpine AS build
2
 
3
- # Set working directory
4
- WORKDIR /app
5
 
6
- # Copy the viewer directory with all its contents
7
- COPY viewer/ .
8
 
9
- # Install dependencies
10
- RUN npm install
 
11
 
12
- # Build the application
13
- RUN npm run build || (echo "Build failed. Check the error messages above." && exit 1)
14
 
15
- # Production stage
16
- FROM nginx:alpine
17
 
18
- # Copy built assets from build stage
19
- COPY --from=build /app/dist /usr/share/nginx/html
 
 
 
20
 
21
- # Copy nginx configuration
22
- COPY viewer/nginx.conf /etc/nginx/conf.d/default.conf
23
 
24
  # Expose port
25
  EXPOSE 7860
26
 
27
- # Start nginx
28
- CMD ["nginx", "-g", "daemon off;"]
 
1
+ FROM node:18-alpine
2
 
3
+ # Set up a new user named "user" with user ID 1000
4
+ RUN adduser -D user || adduser -D -u 1001 user
5
 
6
+ # Switch to the "user" user
7
+ USER user
8
 
9
+ # Set home to the user's home directory
10
+ ENV HOME=/home/user \
11
+ PATH=/home/user/.local/bin:$PATH
12
 
13
+ # Set the working directory
14
+ WORKDIR $HOME/app
15
 
16
+ # Copy package files
17
+ COPY --chown=user viewer/package*.json ./
18
 
19
+ # Install dependencies
20
+ RUN npm install
21
+
22
+ # Copy the rest of the application
23
+ COPY --chown=user viewer/ .
24
 
25
+ # Build the application
26
+ RUN npm run build
27
 
28
  # Expose port
29
  EXPOSE 7860
30
 
31
+ # Start the application
32
+ CMD ["npm", "run", "preview", "--", "--port", "7860", "--host"]