OsamaBinLikhon commited on
Commit
4d74380
·
verified ·
1 Parent(s): 5192008

Simplified Google Antigravity with basic Google Cloud SDK

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -26
Dockerfile CHANGED
@@ -1,43 +1,44 @@
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. Install Python3 (required for the web app)
30
- RUN apt install -y python3
 
 
 
31
 
32
- # 7. Copy the application files (as root)
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
- chown -R user:user /home/user
37
-
38
- # 8. Switch to the non-root user
39
  USER user
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- # 10. Define the command to run when the container starts
42
- # This runs the Python web application that demonstrates the antigravity package
43
  CMD ["python3", "/home/user/app.py"]
 
1
+ # Simplified Dockerfile for Google Antigravity Sandbox
2
  FROM ubuntu:22.04
3
 
 
4
  ENV DEBIAN_FRONTEND=noninteractive
5
 
6
+ # Install basic packages first
 
 
 
 
 
 
 
 
 
7
  RUN apt update && \
8
+ apt install -y curl gnupg apt-transport-https ca-certificates python3 python3-pip wget
9
+
10
+ # Add Antigravity repository
11
+ RUN mkdir -p /etc/apt/keyrings && \
12
  curl -fsSL https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg | \
13
  gpg --dearmor --yes -o /etc/apt/keyrings/antigravity-repo-key.gpg && \
14
  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" | \
15
  tee /etc/apt/sources.list.d/antigravity.list > /dev/null
16
 
17
+ # Update and install antigravity
18
  RUN apt update && \
19
  apt install -y antigravity
20
 
21
+ # Install Google Cloud SDK
22
+ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
23
+ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \
24
+ apt update && \
25
+ apt install -y google-cloud-cli
26
 
27
+ # Create user
28
+ RUN useradd -m -u 1000 user
 
 
 
 
 
29
  USER user
30
+ WORKDIR /home/user
31
+
32
+ # Install simple app
33
+ RUN pip3 install requests
34
+
35
+ # Copy application
36
+ COPY app_google.py /home/user/app.py
37
+
38
+ # Set environment variables
39
+ ENV GOOGLE_CLOUD_PROJECT=""
40
+ ENV GOOGLE_APPLICATION_CREDENTIALS=""
41
+ ENV PORT=7860
42
 
43
+ # Start application
 
44
  CMD ["python3", "/home/user/app.py"]