@stacksjs/ts-cloud 0.4.1 → 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 +21 -12
- 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.
|
|
@@ -26685,16 +26692,17 @@ function buildPhpRuntimeLayerZip(options = {}) {
|
|
|
26685
26692
|
writeFileSync52(join9(stage, "Dockerfile"), generatePhpLayerDockerfile(options));
|
|
26686
26693
|
step("Building PHP runtime image (docker)");
|
|
26687
26694
|
execFileSync2("docker", ["build", "--platform", platform, "-t", imageTag, stage], { stdio: "inherit" });
|
|
26688
|
-
step("Extracting /opt from image");
|
|
26695
|
+
step("Extracting /opt/php from image");
|
|
26689
26696
|
const cid = execFileSync2("docker", ["create", "--platform", platform, imageTag], { encoding: "utf-8" }).trim();
|
|
26690
26697
|
const optDir = join9(stage, "opt");
|
|
26698
|
+
mkdirSync22(optDir, { recursive: true });
|
|
26691
26699
|
try {
|
|
26692
|
-
execFileSync2("docker", ["cp", `${cid}:/opt
|
|
26700
|
+
execFileSync2("docker", ["cp", `${cid}:/opt/php`, join9(optDir, "php")], { stdio: "inherit" });
|
|
26693
26701
|
} finally {
|
|
26694
26702
|
execFileSync2("docker", ["rm", cid], { stdio: "ignore" });
|
|
26695
26703
|
}
|
|
26696
|
-
if (!existsSync52(optDir))
|
|
26697
|
-
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");
|
|
26698
26706
|
const entries = [];
|
|
26699
26707
|
for (const file of walk(optDir)) {
|
|
26700
26708
|
const rel = relative22(optDir, file).replace(/\\/g, "/");
|
|
@@ -45734,6 +45742,7 @@ async function sendFallbackSms(to, message) {
|
|
|
45734
45742
|
PHP_LAYER_EXTENSIONS = [
|
|
45735
45743
|
"cli",
|
|
45736
45744
|
"fpm",
|
|
45745
|
+
"curl",
|
|
45737
45746
|
"mbstring",
|
|
45738
45747
|
"xml",
|
|
45739
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": {
|