Dinnerbone5443 commited on
Commit
d0b5e99
·
verified ·
1 Parent(s): 1ce4b10

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -6
Dockerfile CHANGED
@@ -1,12 +1,13 @@
1
  FROM calciumion/new-api:latest
2
 
3
- # Install python and hf_hub to handle the transfer
4
- RUN apt-get update && apt-get install -y python3 python3-pip
5
- RUN pip3 install huggingface_hub
 
6
 
7
- # Your existing setup
8
  EXPOSE 3000
9
  ENV PORT=7860
10
 
11
- # This is the "Magic" - It starts your API AND a background backup script
12
- CMD ["/bin/sh", "-c", "/app/new-api & while true; do sleep 86400; python3 -c 'from huggingface_hub import HfApi; api=HfApi(); api.upload_folder(folder_path=\"/app/logs\", repo_id=\"Dinnerbone/my-api-backup\", repo_type=\"dataset\")'; done"]
 
 
1
  FROM calciumion/new-api:latest
2
 
3
+ # Install python and hf_hub in one go
4
+ RUN apt-get update && apt-get install -y python3 python3-pip && \
5
+ pip3 install huggingface_hub --break-system-packages && \
6
+ apt-get clean && rm -rf /var/lib/apt/lists/*
7
 
 
8
  EXPOSE 3000
9
  ENV PORT=7860
10
 
11
+ # Start new-api and the background backup loop
12
+ # Replace 'your-username/your-dataset' with your actual info
13
+ CMD ["/bin/sh", "-c", "/app/new-api & while true; do sleep 86400; python3 -c 'from huggingface_hub import HfApi; import os; api=HfApi(); api.upload_file(path_or_fileobj=\"/app/new-api.log\", path_in_repo=\"backup.log\", repo_id=\"Dinnerbone5443/My-api-backup\", token=os.environ.get(\"HF_TOKEN\"))' ; done"]