jmanhype commited on
Commit
cc7f780
Β·
1 Parent(s): 107ca81

feat: add Python and Gradio test app

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -14
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM ubuntu:22.04
2
 
3
- # Force rebuild timestamp: 2024-12-05 20:00
4
  LABEL MAINTAINER="jmanhype"
5
  LABEL Description="Test dockerfile for Hugging Face Space"
6
 
@@ -10,6 +10,9 @@ SHELL ["/bin/bash", "--login", "-c"]
10
  RUN apt-get update && apt-get install -y \
11
  wget \
12
  git \
 
 
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
  # Set up a new user named "user" with user ID 1000
@@ -25,25 +28,18 @@ ENV HOME=/home/user \
25
  # Set the working directory to the user's home directory
26
  WORKDIR $HOME/app
27
 
 
 
 
28
  # Configure git for the user
29
  RUN git config --global user.email "[email protected]" && \
30
  git config --global user.name "jmanhype"
31
 
32
- # This is a test Dockerfile to see if it's actually being used
33
- RUN echo "TESTING IF THIS DOCKERFILE IS ACTUALLY USED" > $HOME/test_file.txt && \
34
- echo "If you see this message, the correct Dockerfile is being used!"
35
-
36
- # Create a very obvious test directory
37
- RUN mkdir -p $HOME/THIS_IS_A_TEST_DIRECTORY && \
38
- echo "TEST CONTENT" > $HOME/THIS_IS_A_TEST_DIRECTORY/test.txt
39
-
40
- # Print test message during build
41
- RUN echo "=================================================" && \
42
- echo "THIS IS A TEST BUILD - IF YOU SEE THIS, THE DOCKERFILE IS BEING USED" && \
43
- echo "================================================="
44
 
45
  # Create and set up entrypoint script
46
- RUN echo '#!/bin/bash\necho "Starting test..."\ncat $HOME/test_file.txt\necho "Test complete!"' > $HOME/entrypoint.sh && \
47
  chmod +x $HOME/entrypoint.sh
48
 
49
  EXPOSE 7860
 
1
  FROM ubuntu:22.04
2
 
3
+ # Force rebuild timestamp: 2024-12-05 20:05
4
  LABEL MAINTAINER="jmanhype"
5
  LABEL Description="Test dockerfile for Hugging Face Space"
6
 
 
10
  RUN apt-get update && apt-get install -y \
11
  wget \
12
  git \
13
+ python3 \
14
+ python3-pip \
15
+ python3-dev \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
  # Set up a new user named "user" with user ID 1000
 
28
  # Set the working directory to the user's home directory
29
  WORKDIR $HOME/app
30
 
31
+ # Install Python packages
32
+ RUN pip3 install --user gradio numpy
33
+
34
  # Configure git for the user
35
  RUN git config --global user.email "[email protected]" && \
36
  git config --global user.name "jmanhype"
37
 
38
+ # Create a simple test Python app
39
+ RUN echo 'import gradio as gr\n\ndef greet(name):\n return f"Hello {name}!"\n\ndemo = gr.Interface(fn=greet, inputs="text", outputs="text")\n\nif __name__ == "__main__":\n demo.launch(server_name="0.0.0.0", server_port=7860)' > $HOME/app/test_app.py
 
 
 
 
 
 
 
 
 
 
40
 
41
  # Create and set up entrypoint script
42
+ RUN echo '#!/bin/bash\necho "Starting Gradio test app..."\npython3 test_app.py' > $HOME/entrypoint.sh && \
43
  chmod +x $HOME/entrypoint.sh
44
 
45
  EXPOSE 7860