veltrixcode commited on
Commit
2f70eaf
Β·
verified Β·
1 Parent(s): 1793fdd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -21
Dockerfile CHANGED
@@ -1,23 +1,9 @@
1
- FROM python:3.11-slim
2
 
3
- WORKDIR /app
4
 
5
- RUN pip install --no-cache-dir requests
6
-
7
- CMD python - << 'EOF'
8
- import requests, time
9
-
10
- def get_ip():
11
- try:
12
- r = requests.get("https://api.ipify.org?format=json", timeout=10)
13
- return r.json()["ip"]
14
- except Exception as e:
15
- return f"error: {e}"
16
-
17
- print("πŸš€ Container started")
18
- print("🌍 Public IP:", get_ip())
19
-
20
- while True:
21
- time.sleep(30)
22
- print("🌍 Public IP:", get_ip())
23
- EOF
 
1
+ FROM alpine:3.19
2
 
3
+ RUN apk add --no-cache curl
4
 
5
+ CMD sh -c 'echo "πŸš€ Container started"; \
6
+ while true; do \
7
+ echo "🌍 Public IP: $(curl -s https://api.ipify.org)"; \
8
+ sleep 30; \
9
+ done'