@aifabrix/builder 2.0.4 → 2.0.6
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/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@aifabrix/builder)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
5
6
|
Local development infrastructure + Azure deployment tool.
|
|
6
7
|
|
|
7
8
|
## Install
|
|
@@ -107,14 +107,23 @@ function buildRequiresConfig(config) {
|
|
|
107
107
|
* @returns {Object} Service configuration
|
|
108
108
|
*/
|
|
109
109
|
function buildServiceConfig(appName, config, port) {
|
|
110
|
-
|
|
110
|
+
// Container port: build.containerPort > config.port
|
|
111
|
+
const containerPortValue = config.build?.containerPort || config.port || port;
|
|
112
|
+
|
|
113
|
+
// Host port logic:
|
|
114
|
+
// - If containerPort is specified: use options.port or build.localPort
|
|
115
|
+
// - If containerPort is NOT specified: use options.port if provided, otherwise config.port (same as container port)
|
|
116
|
+
const hostPort = config.build?.containerPort
|
|
117
|
+
? (port || config.build?.localPort || config.port || 3000) // If containerPort exists, use options.port or localPort
|
|
118
|
+
: (port !== config.port ? port : config.port || port); // If no containerPort, use options.port if different, else config.port
|
|
111
119
|
|
|
112
120
|
return {
|
|
113
121
|
app: buildAppConfig(appName, config),
|
|
114
122
|
image: buildImageConfig(config, appName),
|
|
115
|
-
port:
|
|
123
|
+
port: containerPortValue, // Container port (for health check and template)
|
|
124
|
+
containerPort: config.build?.containerPort || null, // Explicit containerPort if specified, null otherwise
|
|
116
125
|
build: {
|
|
117
|
-
localPort: port
|
|
126
|
+
localPort: hostPort // Host port
|
|
118
127
|
},
|
|
119
128
|
healthCheck: buildHealthCheckConfig(config),
|
|
120
129
|
...buildRequiresConfig(config)
|
|
@@ -158,7 +167,8 @@ async function generateDockerCompose(appName, config, options) {
|
|
|
158
167
|
const language = config.build?.language || config.language || 'typescript';
|
|
159
168
|
const template = loadDockerComposeTemplate(language);
|
|
160
169
|
|
|
161
|
-
|
|
170
|
+
// Determine port: use options.port if provided, otherwise use config.port (ignore build.localPort when no containerPort)
|
|
171
|
+
const port = options.port || (config.build?.containerPort ? config.build?.localPort : null) || config.port || 3000;
|
|
162
172
|
|
|
163
173
|
const serviceConfig = buildServiceConfig(appName, config, port);
|
|
164
174
|
const volumesConfig = buildVolumesConfig(appName);
|
package/package.json
CHANGED