Spaces:
Runtime error
Runtime error
Upload Dockerfile
Browse files- Dockerfile +21 -12
Dockerfile
CHANGED
@@ -1,18 +1,23 @@
|
|
1 |
FROM node:alpine
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
USER node
|
12 |
|
13 |
# Set environment variables for the user
|
14 |
ENV HOME=/home/node \
|
15 |
-
PATH=/home/node/.local/bin:$PATH
|
|
|
16 |
|
17 |
# Set the working directory
|
18 |
WORKDIR $HOME/app
|
@@ -22,14 +27,18 @@ COPY --chown=node:node package*.json ./
|
|
22 |
|
23 |
# Install Node.js dependencies
|
24 |
RUN npm install
|
25 |
-
|
|
|
|
|
26 |
|
27 |
# Copy the application code to the working directory
|
28 |
COPY --chown=node:node . .
|
29 |
|
30 |
-
#
|
31 |
RUN chown -R node:node .
|
32 |
|
33 |
# Expose the port the app runs on
|
|
|
|
|
34 |
# Command to run the Node.js server
|
35 |
-
CMD ["node", "index.js"]
|
|
|
1 |
FROM node:alpine
|
2 |
|
3 |
+
# Install dependencies needed for Playwright
|
4 |
+
RUN apk add --no-cache \
|
5 |
+
git \
|
6 |
+
bash \
|
7 |
+
libc6-compat \
|
8 |
+
nss \
|
9 |
+
chromium \
|
10 |
+
harfbuzz \
|
11 |
+
ca-certificates \
|
12 |
+
ttf-freefont
|
13 |
+
|
14 |
+
# Switch to the node user
|
15 |
USER node
|
16 |
|
17 |
# Set environment variables for the user
|
18 |
ENV HOME=/home/node \
|
19 |
+
PATH=/home/node/.local/bin:$PATH \
|
20 |
+
PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright
|
21 |
|
22 |
# Set the working directory
|
23 |
WORKDIR $HOME/app
|
|
|
27 |
|
28 |
# Install Node.js dependencies
|
29 |
RUN npm install
|
30 |
+
|
31 |
+
# Install Playwright and its dependencies
|
32 |
+
RUN npx playwright install --with-deps
|
33 |
|
34 |
# Copy the application code to the working directory
|
35 |
COPY --chown=node:node . .
|
36 |
|
37 |
+
# Ensure the ownership of the directory to the node user
|
38 |
RUN chown -R node:node .
|
39 |
|
40 |
# Expose the port the app runs on
|
41 |
+
EXPOSE 3000
|
42 |
+
|
43 |
# Command to run the Node.js server
|
44 |
+
CMD ["node", "index.js"]
|