Skip to content

Commit 9ca3a1f

Browse files
Added dev files for docker
1 parent f679190 commit 9ca3a1f

4 files changed

Lines changed: 86 additions & 13 deletions

File tree

.env.sample

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
# For Development
21
DATABASE_URL="file:db/db.sqlite"
32

4-
# For Production
5-
# DATABASE_URL="file:/app/db/db.sqlite"
6-
7-
# For Sentry Error Handling
3+
# For Production Only
84
VITE_SENTRY_DSN=""
9-
105
VITE_ANALYTICS_SCRIPT=""
116
VITE_ANALYTICS_WEBSITE_ID=""
12-
13-
# Umami Analytics
147
UMAMI_DATABASE_URL=postgresql://umami:umami@umami-db:5432/umami
158
UMAMI_APP_SECRET=some-long-random-secret
169
UMAMI_DB_NAME=umami

Dockerfile.dev

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM oven/bun
2+
3+
# set the working directory
4+
WORKDIR /app
5+
6+
# copy package json and lockfile to the container
7+
COPY package.json bun.lock ./
8+
9+
# install dependencies (including dev dependencies)
10+
RUN bun install
11+
12+
# copy the rest of the application code
13+
# Note: In development, this will be overridden by volume mount
14+
COPY . .
15+
16+
# expose the port
17+
EXPOSE 3000
18+
19+
# run migrations and start the development server
20+
# This command can be overridden in docker-compose.dev.yml
21+
CMD ["sh", "-c", "bun run db:migrate && bun run dev"]

README.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,52 @@ You can try it out at [whim.day](https://whim.day)
66

77
## Running it locally
88

9-
### Prerequisites
9+
### Option 1: With Docker (No Bun installation required)
10+
11+
If you prefer not to install Bun on your machine, you can run the entire development environment using Docker:
12+
13+
#### Prerequisites
14+
- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/)
15+
16+
#### Installation
17+
18+
Clone the repository:
19+
20+
```bash
21+
git clone https://github.com/max-programming/whim.git
22+
cd whim
23+
```
24+
25+
#### Set up environment variables
26+
27+
```bash
28+
cp .env.sample .env
29+
```
30+
31+
Edit `.env` with your preferred values for development.
32+
33+
#### Run with Docker
34+
35+
```bash
36+
docker-compose -f docker-compose.dev.yml up
37+
```
38+
39+
The app will be available at `http://localhost:3000`. Your code changes will be automatically reflected thanks to volume mounting.
40+
41+
To stop the development server:
42+
43+
```bash
44+
docker-compose -f docker-compose.dev.yml down
45+
```
46+
47+
### Option 2: Local Development with Bun
48+
49+
#### Prerequisites
1050

1151
- [Bun](https://bun.sh/) (for package management and running the app)
1252
> Or Node with NPM, Yarn or PNPM is also fine
1353
14-
### Installation
54+
#### Installation
1555

1656
Clone the repository and install dependencies:
1757

@@ -21,18 +61,19 @@ cd whim
2161
bun install
2262
```
2363

24-
### Fill in the .env file
64+
#### Fill in the .env file
2565

2666
```bash
2767
cp .env.sample .env
2868
```
2969

30-
### Run the migrations
70+
#### Run the migrations
3171

3272
```bash
3373
bun run db:migrate
3474
```
35-
### Running the App
75+
76+
#### Running the App
3677

3778
Start the development server:
3879

docker-compose.dev.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
services:
2+
app:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile.dev
6+
container_name: whim-app-dev
7+
restart: unless-stopped
8+
volumes:
9+
- .:/app # Mount entire project for live reload
10+
- /app/node_modules # Prevent overwriting node_modules
11+
- ./db:/app/db # Database volume
12+
env_file:
13+
- .env
14+
ports:
15+
- 3000:3000 # Direct port exposure for development
16+
environment:
17+
- NODE_ENV=development
18+
command: bun run dev # Use development command

0 commit comments

Comments
 (0)