fix: base path for docker build

This commit is contained in:
Raj Nandan Sharma
2025-01-24 09:08:13 +05:30
parent a055a616eb
commit f9831490af
3 changed files with 19 additions and 14 deletions

View File

@@ -5,6 +5,7 @@ KENER_BASE_PATH=""
RESEND_API_KEY=
ORIGIN=http://localhost:3000
DATABASE_URL=sqlite://./database/kener.sqlite.db
TZ=UTC
RESEND_SENDER_EMAIL=Accounts <accounts@resend.dev>
# DATABASE_URL=postgresql://myuser:mypassword@localhost:5432/mydatabase

View File

@@ -15,8 +15,10 @@ RUN apt-get update && apt-get install -y \
iputils-ping && \
rm -rf /var/lib/apt/lists/*
# Set the timezone environment variable
# Set the timezone environment variable and the application environment
ARG KENER_BASE_PATH=
ENV TZ=Etc/UTC
ENV KENER_BASE_PATH=${KENER_BASE_PATH}
# Set the working directory
WORKDIR /app

View File

@@ -90,10 +90,6 @@ docker run \
Or use **Docker Compose** with the example [docker-compose.yaml](https://raw.githubusercontent.com/rajnandan1/kener/main/docker-compose.yml)
#### Base path
By default kener runs on `/` but you can change it to `/status` or any other path. Read more about it [here](/docs/environment-vars/#kener-base-path)
#### Postgres
```bash
@@ -118,17 +114,23 @@ docker run \
rajnandan1/kener
```
#### Base Path
#### Base path
By default kener runs on `/` but you can change it to `/status` or any other path. Read more about it [here](/docs/environment-vars/#kener-base-path).
<div class="note info">
- Important: The base path should _**NOT**_ have a trailing slash and should start with `/`
- Important: This env variable should be present during both build and run time
</div>
Let us say you are running kener on a subpath `/status`. You can set the base path like this:
```bash
docker run \
-p 3000:3000 \
-v $(pwd)/uploads:/app/uploads \
-e "KENER_BASE_PATH=/status" \
-e "KENER_SECRET_KEY=somesecretkey" \
-e "DATABASE_URL=mysql://root:password@mysql-container-2.orb.local:3306/kener-2" \
-e "ORIGIN=https://www.example.com" \
rajnandan1/kener
docker build --build-arg KENER_BASE_PATH=/status -t kener .
```
```bash
docker run -p 3000:3000 --env-file .env -v $(pwd)/database:/app/uploads -v $(pwd)/database:/app/database kener
```