From a5ec40c517fae0f35161b29f3248815c59806e3a Mon Sep 17 00:00:00 2001 From: dswbx Date: Thu, 3 Apr 2025 07:58:00 +0200 Subject: [PATCH 1/2] docker: add option to overwrite bknd version used (#136) --- docker/Dockerfile | 6 +++++- docs/integration/docker.mdx | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7507eae4..b61d5d76 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,8 +3,12 @@ FROM node:20 as builder WORKDIR /app +# define bknd version to be used as: +# `docker build --build-arg VERSION= -t bknd .` +ARG VERSION=0.10.2 + # Install & copy required cli -RUN npm install --omit=dev bknd@0.9.1 +RUN npm install --omit=dev bknd@${VERSION} RUN mkdir /output && cp -r node_modules/bknd/dist /output/dist # Stage 2: Final minimal image diff --git a/docs/integration/docker.mdx b/docs/integration/docker.mdx index 5a71f2c1..c535580a 100644 --- a/docs/integration/docker.mdx +++ b/docs/integration/docker.mdx @@ -4,12 +4,9 @@ description: 'Official docker image for bknd' --- # Official `bknd` Docker image -The docker image intentially doesn't copy any data into the image for now, so you can copy the -Dockerfile and build the image anywhere. +The docker image intentially doesn't copy any data into the image for now, so you can copy the Dockerfile and build the image anywhere. -Locate the Dockerfile either by pulling the [repository](https://github.com/bknd-io/bknd) and navigating to the `docker` -directory, -or download from [here](https://github.com/bknd-io/bknd/blob/main/docker/Dockerfile). +Locate the Dockerfile either by pulling the [repository](https://github.com/bknd-io/bknd) and navigating to the `docker` directory, or download from [here](https://github.com/bknd-io/bknd/blob/main/docker/Dockerfile). ## Building the Docker image To build the Docker image, run the following command: @@ -18,6 +15,13 @@ To build the Docker image, run the following command: docker build -t bknd . ``` +If you want to override the bknd version used, you can pass a `VERSION` build argument: +```bash +docker build --build-arg VERSION= -t bknd . +```` + +```bash + ## Running the Docker container To run the Docker container, run the following command: @@ -25,11 +29,7 @@ To run the Docker container, run the following command: docker run -p 1337:1337 bknd ``` -You can pass the same CLI arguments (see [Using the CLI](https://docs.bknd.io/cli) guide) to the -docker container as you'd do with -`npx bknd -run`, -like so: +You can pass the same CLI arguments (see [Using the CLI](https://docs.bknd.io/cli) guide) to the docker container as you'd do with `npx bknd run`, like so: ```bash docker run -p 1337:1337 -e ARGS="--db-url file:/data/data.db" bknd From 0b41aa5a2d1c3b41f4bbe535fcb18e356770d9ac Mon Sep 17 00:00:00 2001 From: dswbx Date: Thu, 3 Apr 2025 09:17:29 +0200 Subject: [PATCH 2/2] cli: create: allow non-interactive create (#137) --- app/src/cli/commands/create/create.ts | 12 +++--- .../commands/create/templates/cloudflare.ts | 37 +++++++++++-------- .../cli/commands/create/templates/index.ts | 1 + 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/app/src/cli/commands/create/create.ts b/app/src/cli/commands/create/create.ts index 478362f2..3c5233d6 100644 --- a/app/src/cli/commands/create/create.ts +++ b/app/src/cli/commands/create/create.ts @@ -8,7 +8,7 @@ import { Option } from "commander"; import { env } from "core"; import color from "picocolors"; import { overridePackageJson, updateBkndPackages } from "./npm"; -import { type Template, templates } from "./templates"; +import { type Template, templates, type TemplateSetupCtx } from "./templates"; import { createScoped, flush } from "cli/utils/telemetry"; const config = { @@ -35,6 +35,8 @@ export const create: CliCommand = (program) => { .addOption(new Option("-i, --integration ", "integration to use")) .addOption(new Option("-t, --template