Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yutakobayashidev committed Oct 8, 2023
2 parents 2e2d6d7 + 94e86c0 commit 13b1434
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 3 deletions.
3 changes: 3 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!package.json
!bun.lockb
4 changes: 2 additions & 2 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DATABASE_URL=for
DATABASE_URL=mysql://root@mysql:3306/captitalens
NEXT_PUBLIC_GA_ID=bar
GOOGLE_ID=baz
GOOGLE_SECRET=qux
Expand All @@ -9,4 +9,4 @@ OPENAI_API_KEY=garply
YOUTUBE_API_KEY=waldo
UPSTASH_REDIS_REST_URL=fred
UPSTASH_REDIS_REST_TOKEN=plugh
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_URL=http://localhost:3000
11 changes: 11 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:18-buster-slim AS base

RUN apt-get update -y && apt-get install -y openssl

FROM base AS dev
ENV NODE_ENV=development
WORKDIR /app
COPY package.json ./
COPY bun.lockb ./
RUN ["npm", "install", "-g", "bun"]
RUN ["bun", "install"]
20 changes: 19 additions & 1 deletion frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# frontend

フロントエンドには Next.js、Prisma、Tailwind CSS を採用しています。
フロントエンドには Next.js、Prisma、Tailwind CSS、bun を採用しています。

## 開発環境の構築

### Docker のセットアップ

(省略)

### 環境変数の準備

```sh
cp .env.example .env
```

### 開発環境の起動

```sh
docker compose up
```

## Storybook

Expand Down
35 changes: 35 additions & 0 deletions frontend/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
services:
mysql:
image: mysql:8.1
volumes:
- mysql_data:/var/lib/mysql
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
command: --default-authentication-plugin=mysql_native_password
ports:
- 3306:3306
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 1s
retries: 30
frontend:
depends_on:
mysql:
condition: service_healthy
build:
context: .
dockerfile: Dockerfile
target: dev
volumes:
- type: bind
source: ./
target: /app
platform: linux/amd64
command: sh -c "bun run prisma-init && bun run dev"
restart: always
ports:
- 3000:3000

volumes:
mysql_data:
driver: local
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"scripts": {
"dev": "next dev",
"prisma-init": "prisma db push && prisma db seed",
"build": "prisma generate && next build",
"start": "next start",
"lint": "next lint",
Expand Down

1 comment on commit 13b1434

@vercel
Copy link

@vercel vercel bot commented on 13b1434 Oct 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.