Commit
·
bafb6c9
1
Parent(s):
a20dc6e
feat: Add Docker proxy configuration for Cloudflare Pages deployment
Browse files- .github/workflows/main.yml +26 -0
- DOCKER_README.md +53 -0
- Dockerfile +11 -0
- nginx.conf +22 -0
.github/workflows/main.yml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Sync to Hugging Face hub
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches: [main]
|
6 |
+
# to run this workflow manually from the Actions tab
|
7 |
+
workflow_dispatch:
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
sync-to-hub:
|
11 |
+
runs-on: ubuntu-latest
|
12 |
+
steps:
|
13 |
+
- name: Checkout main branch
|
14 |
+
uses: actions/checkout@v3
|
15 |
+
with:
|
16 |
+
ref: main
|
17 |
+
fetch-depth: 0
|
18 |
+
lfs: true
|
19 |
+
|
20 |
+
- name: Push to Hugging Face Hub
|
21 |
+
env:
|
22 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
23 |
+
run: |
|
24 |
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
25 |
+
git config --global user.name "GitHub Actions"
|
26 |
+
git push --force https://mantrakp:[email protected]/spaces/mantrakp/sheer main:main
|
DOCKER_README.md
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Cloudflare Pages Proxy Docker Container
|
2 |
+
|
3 |
+
This Docker container sets up an Nginx server that proxies requests to your Cloudflare Pages site (https://sheer-8kp.pages.dev/) and makes it available on port 7860.
|
4 |
+
|
5 |
+
## Requirements
|
6 |
+
|
7 |
+
- Docker installed on your system
|
8 |
+
- Internet access to reach the Cloudflare Pages site
|
9 |
+
|
10 |
+
## Building the Docker Image
|
11 |
+
|
12 |
+
To build the Docker image, navigate to the directory containing the Dockerfile and run:
|
13 |
+
|
14 |
+
```bash
|
15 |
+
docker build -t cloudflare-proxy .
|
16 |
+
```
|
17 |
+
|
18 |
+
## Running the Docker Container
|
19 |
+
|
20 |
+
To start the container:
|
21 |
+
|
22 |
+
```bash
|
23 |
+
docker run -d -p 7860:7860 --name cloudflare-proxy-container cloudflare-proxy
|
24 |
+
```
|
25 |
+
|
26 |
+
After running this command, you can access your Cloudflare Pages site at:
|
27 |
+
|
28 |
+
```
|
29 |
+
http://localhost:7860
|
30 |
+
```
|
31 |
+
|
32 |
+
## Stopping the Container
|
33 |
+
|
34 |
+
To stop the running container:
|
35 |
+
|
36 |
+
```bash
|
37 |
+
docker stop cloudflare-proxy-container
|
38 |
+
```
|
39 |
+
|
40 |
+
## Removing the Container
|
41 |
+
|
42 |
+
To remove the container:
|
43 |
+
|
44 |
+
```bash
|
45 |
+
docker rm cloudflare-proxy-container
|
46 |
+
```
|
47 |
+
|
48 |
+
## Technical Details
|
49 |
+
|
50 |
+
- The container uses Nginx as a reverse proxy
|
51 |
+
- Traffic is forwarded to https://sheer-8kp.pages.dev/
|
52 |
+
- Appropriate headers are set to ensure proper proxying
|
53 |
+
- The container runs on port 7860
|
Dockerfile
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nginx:alpine
|
2 |
+
|
3 |
+
# Create a custom nginx configuration
|
4 |
+
RUN rm /etc/nginx/conf.d/default.conf
|
5 |
+
COPY nginx.conf /etc/nginx/conf.d/
|
6 |
+
|
7 |
+
# Expose port 7860
|
8 |
+
EXPOSE 7860
|
9 |
+
|
10 |
+
# Start Nginx
|
11 |
+
CMD ["nginx", "-g", "daemon off;"]
|
nginx.conf
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
server {
|
2 |
+
listen 7860;
|
3 |
+
server_name localhost;
|
4 |
+
|
5 |
+
location / {
|
6 |
+
proxy_pass https://sheer-8kp.pages.dev/;
|
7 |
+
proxy_set_header Host sheer-8kp.pages.dev;
|
8 |
+
proxy_set_header X-Real-IP $remote_addr;
|
9 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
10 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
11 |
+
proxy_ssl_server_name on;
|
12 |
+
|
13 |
+
# Additional useful headers
|
14 |
+
proxy_set_header Upgrade $http_upgrade;
|
15 |
+
proxy_set_header Connection "upgrade";
|
16 |
+
|
17 |
+
# Timeout settings
|
18 |
+
proxy_read_timeout 90;
|
19 |
+
proxy_connect_timeout 90;
|
20 |
+
proxy_send_timeout 90;
|
21 |
+
}
|
22 |
+
}
|