docker: add option to overwrite bknd version used (#136)

This commit is contained in:
dswbx
2025-04-03 07:58:00 +02:00
committed by GitHub
parent 75e2b96344
commit a5ec40c517
2 changed files with 15 additions and 11 deletions

View File

@@ -3,8 +3,12 @@ FROM node:20 as builder
WORKDIR /app WORKDIR /app
# define bknd version to be used as:
# `docker build --build-arg VERSION=<version> -t bknd .`
ARG VERSION=0.10.2
# Install & copy required cli # 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 RUN mkdir /output && cp -r node_modules/bknd/dist /output/dist
# Stage 2: Final minimal image # Stage 2: Final minimal image

View File

@@ -4,12 +4,9 @@ description: 'Official docker image for bknd'
--- ---
# Official `bknd` Docker image # Official `bknd` Docker image
The docker image intentially doesn't copy any data into the image for now, so you can copy the 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.
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` 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).
directory,
or download from [here](https://github.com/bknd-io/bknd/blob/main/docker/Dockerfile).
## Building the Docker image ## Building the Docker image
To build the Docker image, run the following command: 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 . 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=<version> -t bknd .
````
```bash
## Running the Docker container ## Running the Docker container
To run the Docker container, run the following command: 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 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 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:
docker container as you'd do with
`npx bknd
run`,
like so:
```bash ```bash
docker run -p 1337:1337 -e ARGS="--db-url file:/data/data.db" bknd docker run -p 1337:1337 -e ARGS="--db-url file:/data/data.db" bknd