Skip to content

Commit

Permalink
Improve template repo init (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
dappnodedev authored Aug 13, 2024
1 parent 3bf2e0a commit 86ea3bb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
8 changes: 5 additions & 3 deletions src/commands/init/fileOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -171,8 +171,10 @@ function writeMultiVariantPackageFiles({
serviceName,
version: rootManifest.version
}),
environment: {
[envName]: variant
build: {
args: {
[envName]: variant
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/commands/init/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
17 changes: 8 additions & 9 deletions src/commands/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const init: CommandModule<CliGlobalOptions, InitCommandOptions> = {
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"
Expand All @@ -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
Expand Down

0 comments on commit 86ea3bb

Please sign in to comment.