afscomercial commited on
Commit
c7327da
·
1 Parent(s): e7d0142

update docker

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -0
  2. README.md +20 -9
Dockerfile CHANGED
@@ -21,4 +21,6 @@ COPY . .
21
  # Hugging Face sets the PORT env variable (default 7860)
22
  EXPOSE 7860
23
 
 
 
24
  CMD bash -c "streamlit run app.py --server.port ${PORT:-7860} --server.address 0.0.0.0 --server.headless true"
 
21
  # Hugging Face sets the PORT env variable (default 7860)
22
  EXPOSE 7860
23
 
24
+ RUN mkdir -p /app/cache && chmod 777 /app/cache
25
+
26
  CMD bash -c "streamlit run app.py --server.port ${PORT:-7860} --server.address 0.0.0.0 --server.headless true"
README.md CHANGED
@@ -52,18 +52,29 @@ The container entrypoint launches Streamlit on the port given by the `PORT` envi
52
 
53
  ---
54
 
55
- ## Deploy to Hugging Face Spaces
56
 
57
- 1. **Create a new Space** (type: *Streamlit*) at `https://huggingface.co/new-space` or let the Action do it for you automatically.
58
- 2. **Generate a write token** in your Hugging Face account settings and add it to the repository secrets as `HF_TOKEN`.
59
- 3. Optionally add another secret called `SPACE_REPO` with the full name of the Space (e.g. `your-username/streamlit-chatbot`).
60
 
61
- On each push to the `main` branch the GitHub workflow located at `.github/workflows/deploy-to-spaces.yml` will:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
- * Check out the code.
64
- * Install the `huggingface_hub` CLI.
65
- * Create the Space (if it doesn't exist).
66
- * Force-push the contents of the repository to the Space, triggering a rebuild and redeploy.
67
 
68
  ---
69
 
 
52
 
53
  ---
54
 
55
+ ## Manual deploy to Hugging Face Spaces (CLI)
56
 
57
+ If you'd rather push the repository yourself (skipping GitHub Actions):
 
 
58
 
59
+ ```bash
60
+ # 1. Authenticate once (stores your token locally)
61
+ huggingface-cli login # paste your HF_TOKEN when prompted
62
+
63
+ # 2. (First time only) create the Space as a Docker Space
64
+ huggingface-cli repo create afscomercial/streamlit-chatbot \
65
+ --repo-type space --space-sdk docker -y # change the name accordingly
66
+
67
+ # 3. Add the new remote and push
68
+ cd path/to/streamlit_chatbot
69
+
70
+ git lfs install # enables Large-File Storage just in case
71
+ git remote add hf \
72
+ https://huggingface.co/spaces/afscomercial/streamlit-chatbot
73
+
74
+ git push hf main --force # overwrite contents of the Space
75
+ ```
76
 
77
+ After the push the Space will rebuild the Docker image and redeploy automatically.
 
 
 
78
 
79
  ---
80