Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +29 -0
Dockerfile
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
# Create a user with a specified UID to avoid permission issues
|
4 |
+
RUN useradd -m -u 1000 user
|
5 |
+
|
6 |
+
# Set the working directory to the user's home directory
|
7 |
+
WORKDIR /app
|
8 |
+
|
9 |
+
# Install system dependencies (sudo, npm) as root
|
10 |
+
RUN apt update -y && apt install -y sudo npm
|
11 |
+
|
12 |
+
# Copy package.json and package-lock.json to the working directory and set the owner to user
|
13 |
+
|
14 |
+
# Set the user for subsequent commands
|
15 |
+
COPY --chown=user ./index.js index.js
|
16 |
+
# Install Node.js dependencies
|
17 |
+
RUN npm i express telegraf axios
|
18 |
+
|
19 |
+
# Copy the rest of the application code to the working directory and set the owner to user
|
20 |
+
COPY --chown=user . /app
|
21 |
+
|
22 |
+
# Ensure the user has write permission to health_data.json
|
23 |
+
|
24 |
+
|
25 |
+
# Expose the port your app runs on
|
26 |
+
EXPOSE 7860
|
27 |
+
|
28 |
+
# Command to run your application
|
29 |
+
CMD ["node", "index.js"]
|