@stacksjs/ts-cloud 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +126 -120
- package/dist/index.js +22 -14
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ import { readFileSync as readFileSync5 } from "node:fs";
|
|
|
48
48
|
import { dirname as dirname42, join as join8 } from "node:path";
|
|
49
49
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
50
50
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
51
|
-
import { existsSync as existsSync52, mkdtempSync as mkdtempSync3, readdirSync as readdirSync52, readFileSync as readFileSync6, rmSync as rmSync3, statSync as statSync32, writeFileSync as writeFileSync52 } from "node:fs";
|
|
51
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync22, mkdtempSync as mkdtempSync3, readdirSync as readdirSync52, readFileSync as readFileSync6, rmSync as rmSync3, statSync as statSync32, writeFileSync as writeFileSync52 } from "node:fs";
|
|
52
52
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
53
53
|
import { join as join9, relative as relative22 } from "node:path";
|
|
54
54
|
import { execSync as execSync2 } from "node:child_process";
|
|
@@ -26343,13 +26343,18 @@ function phpLayerBuildStage(phpVersion, asName) {
|
|
|
26343
26343
|
const scl = `php${phpVersion.replace(".", "")}`;
|
|
26344
26344
|
const packages = phpLayerPackages(phpVersion).join(" \\\n ");
|
|
26345
26345
|
const sclRoot = `/opt/remi/${scl}/root`;
|
|
26346
|
-
const
|
|
26346
|
+
const sclEtc = `/etc/opt/remi/${scl}`;
|
|
26347
|
+
const from = asName ? `FROM almalinux:9 AS ${asName}` : "FROM almalinux:9";
|
|
26347
26348
|
return `${from}
|
|
26348
26349
|
|
|
26349
|
-
# Remi
|
|
26350
|
-
|
|
26350
|
+
# Build PHP on AlmaLinux 9 (where Remi's version-isolated SCL packages install
|
|
26351
|
+
# cleanly — Remi's release RPM rejects Amazon Linux 2023). AlmaLinux 9 shares
|
|
26352
|
+
# glibc 2.34 with the provided.al2023 Lambda runtime, and the relocation step
|
|
26353
|
+
# below bundles every non-glibc shared lib under /opt/php/lib, so the resulting
|
|
26354
|
+
# /opt tree runs on Lambda's provided.al2023.
|
|
26355
|
+
RUN dnf -y install epel-release dnf-plugins-core 'dnf-command(config-manager)' && \\
|
|
26356
|
+
dnf config-manager --set-enabled crb && \\
|
|
26351
26357
|
dnf -y install https://rpms.remirepo.net/enterprise/remi-release-9.rpm && \\
|
|
26352
|
-
dnf -y update && \\
|
|
26353
26358
|
dnf -y install \\
|
|
26354
26359
|
${packages} \\
|
|
26355
26360
|
findutils tar gzip && \\
|
|
@@ -26362,7 +26367,10 @@ RUN set -eux; \\
|
|
|
26362
26367
|
cp ${sclRoot}/usr/sbin/php-fpm /opt/php/sbin/php-fpm; \\
|
|
26363
26368
|
EXT_DIR="$(${sclRoot}/usr/bin/php -r 'echo ini_get("extension_dir");')"; \\
|
|
26364
26369
|
cp -a "$EXT_DIR"/*.so /opt/php/lib/php/modules/ || true; \\
|
|
26365
|
-
cp -a ${
|
|
26370
|
+
cp -a ${sclEtc}/php.d/*.ini /opt/php/etc/php.d/ 2>/dev/null || true; \\
|
|
26371
|
+
# Rewrite any absolute extension/zend_extension paths to bare names so they
|
|
26372
|
+
# resolve against the relocated extension_dir.
|
|
26373
|
+
sed -i -E "s#(zend_)?extension *= *.*/([^/]+\\.so)#\\1extension=\\2#" /opt/php/etc/php.d/*.ini 2>/dev/null || true; \\
|
|
26366
26374
|
# Copy shared-library dependencies of php, php-fpm, and the extension modules.
|
|
26367
26375
|
for bin in /opt/php/bin/php /opt/php/sbin/php-fpm /opt/php/lib/php/modules/*.so; do \\
|
|
26368
26376
|
ldd "$bin" 2>/dev/null | awk '/=>/{print $3}/ld-linux/{print $1}' | sort -u | while read -r lib; do \\
|
|
@@ -26370,10 +26378,9 @@ RUN set -eux; \\
|
|
|
26370
26378
|
done; \\
|
|
26371
26379
|
done
|
|
26372
26380
|
|
|
26373
|
-
#
|
|
26381
|
+
# Build the relocated main php.ini: extension_dir + every per-extension directive.
|
|
26374
26382
|
RUN printf 'extension_dir=/opt/php/lib/php/modules\\n' > /opt/php/etc/php.ini && \\
|
|
26375
26383
|
cat /opt/php/etc/php.d/*.ini >> /opt/php/etc/php.ini 2>/dev/null || true
|
|
26376
|
-
ENV PHP_INI_SCAN_DIR=/opt/php/etc/php.d
|
|
26377
26384
|
|
|
26378
26385
|
# Runtime assets (bootstrap, runtime loops, fpm config) are added by the build
|
|
26379
26386
|
# orchestrator after the image is produced. Export /opt as the layer payload.
|
|
@@ -26456,8 +26463,7 @@ function buildBunRuntimeLayerZip(options) {
|
|
|
26456
26463
|
const step = options.onStep ?? (() => {});
|
|
26457
26464
|
const stage = mkdtempSync2(join72(tmpdir2(), "tscloud-bun-layer-"));
|
|
26458
26465
|
try {
|
|
26459
|
-
const
|
|
26460
|
-
const url = `https://github.com/oven-sh/bun/releases/download/${tag}/${bunArch}.zip`;
|
|
26466
|
+
const url = version2 ? `https://github.com/oven-sh/bun/releases/download/bun-v${version2}/${bunArch}.zip` : `https://github.com/oven-sh/bun/releases/latest/download/${bunArch}.zip`;
|
|
26461
26467
|
step(`downloading Bun ${version2 || "latest"} (${architecture})`);
|
|
26462
26468
|
const zipPath = join72(stage, "bun.zip");
|
|
26463
26469
|
fetchToFile(url, zipPath);
|
|
@@ -26686,16 +26692,17 @@ function buildPhpRuntimeLayerZip(options = {}) {
|
|
|
26686
26692
|
writeFileSync52(join9(stage, "Dockerfile"), generatePhpLayerDockerfile(options));
|
|
26687
26693
|
step("Building PHP runtime image (docker)");
|
|
26688
26694
|
execFileSync2("docker", ["build", "--platform", platform, "-t", imageTag, stage], { stdio: "inherit" });
|
|
26689
|
-
step("Extracting /opt from image");
|
|
26695
|
+
step("Extracting /opt/php from image");
|
|
26690
26696
|
const cid = execFileSync2("docker", ["create", "--platform", platform, imageTag], { encoding: "utf-8" }).trim();
|
|
26691
26697
|
const optDir = join9(stage, "opt");
|
|
26698
|
+
mkdirSync22(optDir, { recursive: true });
|
|
26692
26699
|
try {
|
|
26693
|
-
execFileSync2("docker", ["cp", `${cid}:/opt
|
|
26700
|
+
execFileSync2("docker", ["cp", `${cid}:/opt/php`, join9(optDir, "php")], { stdio: "inherit" });
|
|
26694
26701
|
} finally {
|
|
26695
26702
|
execFileSync2("docker", ["rm", cid], { stdio: "ignore" });
|
|
26696
26703
|
}
|
|
26697
|
-
if (!existsSync52(optDir))
|
|
26698
|
-
throw new Error("layer build produced no /opt
|
|
26704
|
+
if (!existsSync52(join9(optDir, "php", "bin", "php")))
|
|
26705
|
+
throw new Error("layer build produced no /opt/php/bin/php");
|
|
26699
26706
|
const entries = [];
|
|
26700
26707
|
for (const file of walk(optDir)) {
|
|
26701
26708
|
const rel = relative22(optDir, file).replace(/\\/g, "/");
|
|
@@ -45735,6 +45742,7 @@ async function sendFallbackSms(to, message) {
|
|
|
45735
45742
|
PHP_LAYER_EXTENSIONS = [
|
|
45736
45743
|
"cli",
|
|
45737
45744
|
"fpm",
|
|
45745
|
+
"curl",
|
|
45738
45746
|
"mbstring",
|
|
45739
45747
|
"xml",
|
|
45740
45748
|
"pdo",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/ts-cloud",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.2",
|
|
5
5
|
"description": "A lightweight, performant infrastructure-as-code library and CLI for deploying both server-based (EC2) and serverless applications.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"test": "bun test"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@ts-cloud/aws-types": "0.4.
|
|
93
|
-
"@ts-cloud/core": "0.4.
|
|
92
|
+
"@ts-cloud/aws-types": "0.4.2",
|
|
93
|
+
"@ts-cloud/core": "0.4.2",
|
|
94
94
|
"@stacksjs/ts-xml": "^0.1.0"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|