Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +7 -21
Dockerfile
CHANGED
|
@@ -1,23 +1,9 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 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'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|