This commit is contained in:
+4
-4
@@ -2,12 +2,12 @@
|
||||
FROM node:24 as builder
|
||||
WORKDIR /app
|
||||
|
||||
# define bknd version to be used as:
|
||||
# `docker build --build-arg VERSION=<version> -t bknd .`
|
||||
# define userbase version to be used as:
|
||||
# `docker build --build-arg VERSION=<version> -t userbase .`
|
||||
ARG VERSION=0.18.0
|
||||
|
||||
# Install & copy required cli
|
||||
RUN npm install --omit=dev bknd@${VERSION}
|
||||
RUN npm install --omit=dev userbase@${VERSION}
|
||||
|
||||
# Stage 2: Final minimal image
|
||||
FROM node:24-alpine
|
||||
@@ -19,7 +19,7 @@ RUN npm install -g pm2
|
||||
RUN echo '{"type":"module"}' > package.json
|
||||
|
||||
# Copy dist and node_modules from builder
|
||||
COPY --from=builder /app/node_modules/bknd/dist ./dist
|
||||
COPY --from=builder /app/node_modules/userbase/dist ./dist
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
# Create volume and init args
|
||||
|
||||
+7
-7
@@ -1,31 +1,31 @@
|
||||
# Official `bknd` Docker image
|
||||
# Official `userbase` 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.
|
||||
|
||||
## Building the Docker image
|
||||
To build the Docker image, run the following command:
|
||||
|
||||
```bash
|
||||
docker build -t bknd .
|
||||
docker build -t userbase .
|
||||
```
|
||||
|
||||
## Running the Docker container
|
||||
To run the Docker container, run the following command:
|
||||
|
||||
```bash
|
||||
docker run -p 1337:1337 bknd
|
||||
docker run -p 1337:1337 userbase
|
||||
```
|
||||
|
||||
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.userbase.io/cli) guide) to the docker container as you'd do with `npx userbase run`, like so:
|
||||
|
||||
```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" userbase
|
||||
```
|
||||
Or connect to a remote turso database:
|
||||
```bash
|
||||
docker run -p 1337:1337 -e ARGS="--db-url libsql://<db>.turso.io --db-token <token>" bknd
|
||||
docker run -p 1337:1337 -e ARGS="--db-url libsql://<db>.turso.io --db-token <token>" userbase
|
||||
```
|
||||
|
||||
To mount the data directory to the host, you can use the `-v` flag:
|
||||
```bash
|
||||
docker run -p 1337:1337 -v /path/to/data:/data bknd
|
||||
docker run -p 1337:1337 -v /path/to/data:/data userbase
|
||||
```
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Build the minimal Alpine image with Node.js
|
||||
docker build -f Dockerfile.minimal -t bknd-minimal .
|
||||
docker build -f Dockerfile.minimal -t userbase-minimal .
|
||||
|
||||
# Run the container with the whole app/src directory mapped
|
||||
docker run -it --rm \
|
||||
-v "$(pwd)/../app:/app/app" \
|
||||
-w /app \
|
||||
-p 1337:1337 \
|
||||
bknd-minimal
|
||||
userbase-minimal
|
||||
|
||||
|
||||
Reference in New Issue
Block a user