Dinnerbone5443 commited on
Commit
eb132f9
·
verified ·
1 Parent(s): da05bf8

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -0
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM calciumion/new-api:latest
2
+
3
+ # 1. Install Python and Pip cleanly
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ python3 \
6
+ python3-pip \
7
+ && pip3 install huggingface_hub --break-system-packages \
8
+ && apt-get clean \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ EXPOSE 3000
12
+ ENV PORT=7860
13
+
14
+ # 2. Start the API and the backup loop
15
+ # This loop waits 24 hours (86400s), then uploads the log file to your private dataset
16
+ CMD ["/bin/sh", "-c", "/app/new-api & while true; do \
17
+ sleep 86400; \
18
+ python3 -c \"from huggingface_hub import HfApi; import os; \
19
+ api=HfApi(); \
20
+ api.upload_file( \
21
+ path_or_fileobj='/app/new-api.log', \
22
+ path_in_repo='daily_backup.log', \
23
+ repo_id='Dinnerbone5443/my-api-backup', \
24
+ repo_type='dataset', \
25
+ token=os.environ.get('HF_TOKEN') \
26
+ )\"; \
27
+ done"]
28
+