diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..2320089d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +Dockerfile +node_modules +.next +.vercel +.wrangler diff --git a/.gitignore b/.gitignore index f3839563..306b5dd8 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,5 @@ Temporary Items # Built Visual Studio Code Extensions *.vsix + +.wrangler diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e2d3c2ca --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM node:20-bullseye-slim AS build + +RUN npm install -g pnpm + +COPY . /src +WORKDIR /src + +RUN pnpm install +RUN npx @cloudflare/next-on-pages + +FROM node:20-bullseye-slim AS runtime + +COPY --from=build /src/.vercel /app/.vercel +WORKDIR /app +RUN npm install wrangler@3.24.0 +RUN apt update && apt -y install ca-certificates && rm -rf /var/lib/apt/lists/* + +EXPOSE 8788 + +CMD ["npx", "wrangler", "pages", "dev", ".vercel/output/static", "--ip=0.0.0.0", "--compatibility-flag=nodejs_compat", "--compatibility-date=2023-10-10", "--kv=ONEDRIVE_CF_INDEX_KV"] \ No newline at end of file diff --git a/README.md b/README.md index 040983c0..6703238a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ ## What's different - Now it can be deployed on Cloudflare Pages for free! +- Also support [Docker Deployment](https://github.com/lyc8503/onedrive-cf-index-ng/wiki/Docker-Deployment) now! - No more dependency on Upstash / 3rd-party service - Maybe some future maintenance or improvements from me ([@lyc8503](https://github.com/lyc8503)) @@ -138,7 +139,7 @@ Yes! Completely free with no backend server what-so-ever. ## Some TODOs - Documentation -- Local/Docker deployment support +- [ x ] Local/Docker deployment support - Some TODOs left in the code - More tests