OsamaBinLikhon commited on
Commit
a09fcb5
·
verified ·
1 Parent(s): fbe2608

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +45 -0
Dockerfile ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 1. Use an Ubuntu base image
2
+ FROM ubuntu:22.04
3
+
4
+ # 2. Set environment variables to prevent interactive prompts during apt install
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # 3. Create a non-root user (Best Practice for Hugging Face Spaces)
8
+ RUN useradd -m -u 1000 user
9
+ USER user
10
+ WORKDIR /home/user
11
+
12
+ # Switch back to root temporarily to perform package installation
13
+ USER root
14
+
15
+ # 4. Install necessary tools and add the Antigravity repository
16
+ # The commands are slightly modified to be run sequentially and cleanly in a Docker build.
17
+ RUN apt update && \
18
+ apt install -y curl gnupg apt-transport-https ca-certificates && \
19
+ mkdir -p /etc/apt/keyrings && \
20
+ curl -fsSL https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg | \
21
+ gpg --dearmor --yes -o /etc/apt/keyrings/antigravity-repo-key.gpg && \
22
+ echo "deb [signed-by=/etc/apt/keyrings/antigravity-repo-key.gpg] https://us-central1-apt.pkg.dev/projects/antigravity-auto-updater-dev/ antigravity-debian main" | \
23
+ tee /etc/apt/sources.list.d/antigravity.list > /dev/null
24
+
25
+ # 5. Update package cache and install the 'antigravity' package
26
+ RUN apt update && \
27
+ apt install -y antigravity
28
+
29
+ # 6. Switch back to the non-root user
30
+ USER user
31
+
32
+ # 7. Copy the application files
33
+ COPY app.py /home/user/app.py
34
+ COPY run_app.sh /home/user/run_app.sh
35
+ RUN chmod +x /home/user/run_app.sh
36
+
37
+ # 8. Install Python3 (required for the web app)
38
+ RUN apt install -y python3
39
+
40
+ # 9. Switch back to the non-root user
41
+ USER user
42
+
43
+ # 10. Define the command to run when the container starts
44
+ # This runs the Python web application that demonstrates the antigravity package
45
+ CMD ["python3", "/home/user/app.py"]