Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/265 Containerize with docker #266

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ If you have some suggestions, feel free to create an issue.

## Running Locally

### With pnpm

1. Install dependencies using pnpm:

```sh
Expand All @@ -85,6 +87,12 @@ cp .env.example .env.local
pnpm dev
```

### With Docker and docker compose

```sh
pnpm docker-dev
```

## License

Licensed under the [MIT license](https://github.com/shadcn/taxonomy/blob/main/LICENSE.md).
7 changes: 7 additions & 0 deletions docker-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh -e

OPTS="-f ./docker/docker-compose.yml"

docker-compose $OPTS down --volumes
docker-compose $OPTS up -d db
docker-compose $OPTS up -d web
10 changes: 10 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:20 as base
RUN npm install -g pnpm

COPY ../ /app
WORKDIR /app

FROM base as base_build

RUN sh -c 'yes | pnpm install'

39 changes: 39 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "3.7"

services:
web:
build:
target: base_build
context: ../
dockerfile: ./docker/Dockerfile
args:
- BUILDKIT_INLINE_CACHE=1
ports:
- "3000:3000"
working_dir: /app
volumes:
- ../:/app
- ./.env.local:/app/.env.local
command: [
"pnpm",
"dev"
]

db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: 'db'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'password'
MYSQL_ROOT_PASSWORD: 'password'
ports:
- '3306:3306'
expose:
- '3306'
volumes:
- my-db:/var/lib/mysql

# Names our volume
volumes:
my-db:
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"start": "next start",
"lint": "next lint",
"preview": "next build && next start",
"postinstall": "prisma generate"
"postinstall": "prisma generate",
"docker-dev": "./docker-run.sh"
},
"dependencies": {
"@editorjs/code": "^2.8.0",
Expand Down