Spaces:
Running
Running
get rid of nginx use
Browse files- Dockerfile +21 -17
Dockerfile
CHANGED
@@ -1,28 +1,32 @@
|
|
1 |
-
FROM node:18-alpine
|
2 |
|
3 |
-
# Set
|
4 |
-
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
|
9 |
-
#
|
10 |
-
|
|
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
|
15 |
-
#
|
16 |
-
|
17 |
|
18 |
-
#
|
19 |
-
|
|
|
|
|
|
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
|
24 |
# Expose port
|
25 |
EXPOSE 7860
|
26 |
|
27 |
-
# Start
|
28 |
-
CMD ["
|
|
|
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"]
|