jmanhype commited on
Commit
357dcd5
Β·
1 Parent(s): ee522dc

fix: simplify script creation approach

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -23
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM ubuntu:22.04
2
 
3
- # Force rebuild timestamp: 2024-12-05 20:20
4
  LABEL MAINTAINER="jmanhype"
5
  LABEL Description="Test dockerfile for Hugging Face Space"
6
 
@@ -35,28 +35,22 @@ RUN pip3 install --user gradio numpy
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
- COPY <<-'EOT' $HOME/app/test_app.py
40
- import gradio as gr
41
-
42
- def greet(name):
43
- return f"Hello {name}!"
44
-
45
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
46
-
47
- if __name__ == "__main__":
48
- demo.launch(server_name="0.0.0.0", server_port=7860)
49
- EOT
50
-
51
- # Create and set up entrypoint script
52
- COPY <<-'EOT' $HOME/entrypoint.sh
53
- #!/bin/bash
54
- echo "Starting Gradio test app..."
55
- python3 test_app.py
56
- EOT
57
-
58
- RUN chmod +x $HOME/entrypoint.sh
59
 
60
  EXPOSE 7860
61
 
62
- CMD ["bash", "-c", "$HOME/entrypoint.sh"]
 
1
  FROM ubuntu:22.04
2
 
3
+ # Force rebuild timestamp: 2024-12-05 20:25
4
  LABEL MAINTAINER="jmanhype"
5
  LABEL Description="Test dockerfile for Hugging Face Space"
6
 
 
35
  RUN git config --global user.email "[email protected]" && \
36
  git config --global user.name "jmanhype"
37
 
38
+ # Create test files
39
+ RUN mkdir -p $HOME/app && cd $HOME/app && \
40
+ echo '#!/bin/bash' > entrypoint.sh && \
41
+ echo 'echo "Starting Gradio test app..."' >> entrypoint.sh && \
42
+ echo 'python3 test_app.py' >> entrypoint.sh && \
43
+ chmod +x entrypoint.sh && \
44
+ echo 'import gradio as gr' > test_app.py && \
45
+ echo '' >> test_app.py && \
46
+ echo 'def greet(name):' >> test_app.py && \
47
+ echo ' return f"Hello {name}!"' >> test_app.py && \
48
+ echo '' >> test_app.py && \
49
+ echo 'demo = gr.Interface(fn=greet, inputs="text", outputs="text")' >> test_app.py && \
50
+ echo '' >> test_app.py && \
51
+ echo 'if __name__ == "__main__":' >> test_app.py && \
52
+ echo ' demo.launch(server_name="0.0.0.0", server_port=7860)' >> test_app.py
 
 
 
 
 
 
53
 
54
  EXPOSE 7860
55
 
56
+ CMD ["./entrypoint.sh"]