noherczeg / wrangler-docker-wrapper

Externalize Cloudflare Wrangler related sources and binaries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrangler Docker Wrapper

The Wrangler CLI comes with all kinds of dependencies like github.com connection, Rust, and related solutions which might not be necessary for static website projects.

This image contains everything necessary to publish with wrangler, no additional steps will be involved.

Deploy

Static web folder MUST be mapped to /opt/project/public.

You might want to use different CF_APP_NAME for prod and dev modes to prevent potential name collisions for your Workers

Dev

Will deploy to *.workers.dev.

docker run -it --rm \
  -e CF_ACCOUNT_ID="YOUR_ACCOUNT_ID" \
  -e CF_API_TOKEN="YOUR_API_TOKEN" \
  -e CF_APP_NAME="NAME_OF_YOUR_APP" \
  -v $(pwd)/project/public:/opt/project/public \ 
  noherczeg/wrangler-docker-wrapper:1.1.2

Production

Specifying the CF_ROUTE environment variable turns off workders.dev deployment.

docker run -it --rm \
  -e CF_ACCOUNT_ID="YOUR_ACCOUNT_ID" \
  -e CF_API_TOKEN="YOUR_API_TOKEN" \
  -e CF_APP_NAME="NAME_OF_YOUR_APP" \
  -e CF_ZONE_ID="YOUR_ZONE_ID" \
  -e CF_ROUTE="ROUTE_TO_WORKER" \
  -v $(pwd)/project/public:/opt/project/public \
  noherczeg/wrangler-docker-wrapper:1.1.0

Overriding Worker Script

This Container uses a default script (./project/workers-site/index.js).

You can override the script by mapping your own file when running the Container.

-v SOME_PATH/index.js:/opt/project/workers-site/index.js

Additional environment variables

  • NPM_REGISTRY
  • NPM_HTTP_PROXY
  • NPM_HTTPS_PROXY

You are not expected to rely on these.

Resources

Template Source

LICENSE

MIT

About

Externalize Cloudflare Wrangler related sources and binaries


Languages

Language:JavaScript 61.1%Language:Dockerfile 18.7%Language:Shell 14.0%Language:HTML 5.1%Language:CSS 1.1%