- API: `pnpm build` bundles dist/ into apps/api/.output (esbuild), with Linux musl native packages for sharp and argon2 kept alongside - docker/api.Dockerfile copies that output; no pnpm install on the server - add dist/migrate.js (prisma migrate deploy equivalent, same _prisma_migrations table and lock) so the Prisma CLI is not needed at runtime - pnpm-workspace: supportedArchitectures for linux/x64/musl - admin: apps/admin/.env.production sets VITE_SITE_URL for the production build - drop NPM_REGISTRY / SITE_URL build args from compose and .env.example - gitignore: anchor node_modules rules so pre-built node_modules are committed - README: describe the pre-built deploy flow Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
// Copyright 2017 Lovell Fuller and others.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
'use strict';
|
|
|
|
const fs = require('fs');
|
|
|
|
const LDD_PATH = '/usr/bin/ldd';
|
|
const SELF_PATH = '/proc/self/exe';
|
|
const MAX_LENGTH = 2048;
|
|
|
|
/**
|
|
* Read the content of a file synchronous
|
|
*
|
|
* @param {string} path
|
|
* @returns {Buffer}
|
|
*/
|
|
const readFileSync = (path) => {
|
|
const fd = fs.openSync(path, 'r');
|
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
const bytesRead = fs.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
fs.close(fd, () => {});
|
|
return buffer.subarray(0, bytesRead);
|
|
};
|
|
|
|
/**
|
|
* Read the content of a file
|
|
*
|
|
* @param {string} path
|
|
* @returns {Promise<Buffer>}
|
|
*/
|
|
const readFile = (path) => new Promise((resolve, reject) => {
|
|
fs.open(path, 'r', (err, fd) => {
|
|
if (err) {
|
|
reject(err);
|
|
} else {
|
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
fs.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
resolve(buffer.subarray(0, bytesRead));
|
|
fs.close(fd, () => {});
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
module.exports = {
|
|
LDD_PATH,
|
|
SELF_PATH,
|
|
readFileSync,
|
|
readFile
|
|
};
|