From 01691d0db7684b85ae551fa40dfabb660b78f599 Mon Sep 17 00:00:00 2001 From: dappnodedev Date: Mon, 12 Aug 2024 17:03:05 +0200 Subject: [PATCH] Improve template repo init --- src/commands/init/fileOperations.ts | 8 +++++--- src/commands/init/handler.ts | 4 +++- src/commands/init/index.ts | 17 ++++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/commands/init/fileOperations.ts b/src/commands/init/fileOperations.ts index 781830fa..31cf4d4e 100644 --- a/src/commands/init/fileOperations.ts +++ b/src/commands/init/fileOperations.ts @@ -7,7 +7,7 @@ import { defaultVariantsEnvName } from "../../params.js"; import { UserAnswers } from "./types.js"; -import { Compose, Manifest, getImageTag, releaseFiles } from "@dappnode/types"; +import { Compose, getImageTag, Manifest, releaseFiles } from "@dappnode/types"; import { getComposePath, getManifestPath, @@ -171,8 +171,10 @@ function writeMultiVariantPackageFiles({ serviceName, version: rootManifest.version }), - environment: { - [envName]: variant + build: { + args: { + [envName]: variant + } } } } diff --git a/src/commands/init/handler.ts b/src/commands/init/handler.ts index 783ca60c..3f22631b 100644 --- a/src/commands/init/handler.ts +++ b/src/commands/init/handler.ts @@ -87,7 +87,9 @@ function buildCompose({ version: "3.5", services: { [serviceName]: { - build: ".", // Dockerfile is in root dir + build: { + context: "." + }, image: getImageTag({ dnpName, serviceName, version }), restart: "unless-stopped" } diff --git a/src/commands/init/index.ts b/src/commands/init/index.ts index 38b1f2a7..f9f272c9 100644 --- a/src/commands/init/index.ts +++ b/src/commands/init/index.ts @@ -29,7 +29,7 @@ export const init: CommandModule = { type: "boolean" }, use_variants: { - alias: "t", + alias: ["t", "use-variants"], description: "Initialize a template Dappnode package, for creating several package variants that have the same base structure.", type: "boolean" @@ -47,14 +47,13 @@ To start, you can: - Develop your dockerized app in ${path.join(dir, dockerfileName)} - Add settings in the compose at ${path.join(dir, defaultComposeFileName)} - Add metadata in the manifest at ${path.join(dir, defaultManifestFileName)} -${ - args.use_variants - ? `- Define the specific features of each variant in ${path.join( - dir, - defaultVariantsDirName - )}` - : "" -} +${args.use_variants + ? `- Define the specific features of each variant in ${path.join( + dir, + defaultVariantsDirName + )}` + : "" + } Once ready, you can build, install, and test it by running