Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve template repo init #449

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Improve template repo init
dappnodedev committed Aug 12, 2024
commit 01691d0db7684b85ae551fa40dfabb660b78f599
8 changes: 5 additions & 3 deletions src/commands/init/fileOperations.ts
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
4 changes: 3 additions & 1 deletion src/commands/init/handler.ts
Original file line number Diff line number Diff line change
@@ -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"
}
17 changes: 8 additions & 9 deletions src/commands/init/index.ts
Original file line number Diff line number Diff line change
@@ -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"
@@ -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


Unchanged files with check annotations Beta

created: number;
image: string;
ip?: string;
state: any;

Check warning on line 276 in src/commands/githubActions/endToEndTest/types.ts

GitHub Actions / test (18)

Unexpected any. Specify a different type

Check warning on line 276 in src/commands/githubActions/endToEndTest/types.ts

GitHub Actions / test (20)

Unexpected any. Specify a different type
running: boolean;
exitCode: number | null;
ports: any[];

Check warning on line 279 in src/commands/githubActions/endToEndTest/types.ts

GitHub Actions / test (18)

Unexpected any. Specify a different type

Check warning on line 279 in src/commands/githubActions/endToEndTest/types.ts

GitHub Actions / test (20)

Unexpected any. Specify a different type
volumes: any[];
networks: {
name: string;