ci: GHCR docker build for Lite branch + compose updates

- .github/workflows/docker-lite.yml: build & push ghcr.io/lezi-fun/
  forumlify-deploy:lite on Lite branch push (linux/amd64+arm64)
- docker-compose.yml: pull :lite image from GHCR, add PORT / ENABLE_
  CAPTCHA env, restart: unless-stopped on both services
This commit is contained in:
lezi-fun committed 2026-08-12 09:21:12 +08:00
1 parent 8f88f803f5
commit 9e407d0a2d
1532 files changed
+645187 -1

No files matched your search

+86
View File
@@ -0,0 +1,86 @@
import { AsyncLocalStorage } from "node:async_hooks";
import process from "node:process";
import stream from "node:stream";
import * as nextEnvVars from "./next-env.mjs";
const cloudflareContextALS = new AsyncLocalStorage();
Object.defineProperty(globalThis, /* @__PURE__ */ Symbol.for("__cloudflare-context__"), {
get() {
return cloudflareContextALS.getStore();
}
});
async function runWithCloudflareRequestContext(request, env, ctx, handler) {
init(request, env);
return cloudflareContextALS.run({ env, ctx, cf: request.cf }, handler);
}
let initialized = false;
function init(request, env) {
if (initialized) {
return;
}
initialized = true;
const url = new URL(request.url);
initRuntime();
populateProcessEnv(url, env);
}
function initRuntime() {
globalThis.__dirname ??= "";
globalThis.__filename ??= "";
import.meta.url ??= "file:///worker.js";
const __original_fetch = globalThis.fetch;
globalThis.fetch = (input, init2) => {
if (init2) {
delete init2.cache;
}
return __original_fetch(input, init2);
};
const CustomRequest = class extends globalThis.Request {
constructor(input, init2) {
if (init2) {
delete init2.cache;
Object.defineProperty(init2, "body", {
// @ts-ignore
value: init2.body instanceof stream.Readable ? ReadableStream.from(init2.body) : init2.body
});
}
super(input, init2);
}
};
Object.assign(globalThis, {
Request: CustomRequest,
__BUILD_TIMESTAMP_MS__: 1786412455024,
__NEXT_BASE_PATH__: "",
__ASSETS_RUN_WORKER_FIRST__: false,
__TRAILING_SLASH__: false,
// The external middleware will use the convertTo function of the `edge` converter
// by default it will try to fetch the request, but since we are running everything in the same worker
// we need to use the request as is.
__dangerous_ON_edge_converter_returns_request: true
});
}
function populateProcessEnv(url, env) {
for (const [key, value] of Object.entries(env)) {
if (typeof value === "string") {
process.env[key] = value;
}
}
const mode = env.NEXTJS_ENV ?? "production";
if (nextEnvVars[mode]) {
for (const key in nextEnvVars[mode]) {
process.env[key] ??= nextEnvVars[mode][key];
}
}
process.env.OPEN_NEXT_ORIGIN = JSON.stringify({
default: {
host: url.hostname,
protocol: url.protocol.slice(0, -1),
port: url.port
}
});
process.env.__NEXT_PRIVATE_ORIGIN = url.origin;
if ("") {
process.env.DEPLOYMENT_ID = "";
}
}
export {
runWithCloudflareRequestContext
};