Skip to content

MachWheel/docker-nextjs-cloudflared

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A docker container to serve NextJS builds using Cloudflare Tunnels

Requirements:

  • A Cloudflare account and any domain that you own which uses Cloudflare DNS
  • An /out NextJS build folder created with npx next build
  • Docker installed and running.

1. How to create a local tunnel

- On Windows:

1. Download and install cloudflared-windows-amd64.msi

2. Run cmd as admin:

  • First:
cloudflared.exe login
  • then:
cloudflared tunnel create TUNNEL_NAME_HERE

3. Copy the created MY_TUNNEL_UUID.json file to /tunnels folder

4 Fill in the /tunnels/config.yml file with the tunnel data

5. Go to https://dash.cloudflare.com/

6. Go to DNS > Records

7. Press + Add Record and fill:

  • Type: CNAME
  • Name: YOUR_SUBDOMAIN
  • Target: MY_TUNNEL_UUID.cfargotunnel.com
  • Proxied / TTL Auto

8. Press Save

2. Building the container:

1. Replace the ./out folder with yours

2. Inside ./ execute:

docker build -t docker-nextjs-cloudflared .
  • then run:
docker run -p 3000:3000 docker-nextjs-cloudflared

About

A docker container to serve NextJS builds using Cloudflare Tunnels

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors