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

Added the docker setup. #19

Open
wants to merge 1 commit into
base: master
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.git
.gitignore
.env.example
.env
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

FROM node:20-alpine

WORKDIR /usr/src/app

COPY package*.json ./

COPY apps/frontend/package*.json ./apps/frontend/
COPY apps/backend/package*.json ./apps/backend/
RUN npm install

COPY . .


EXPOSE 5173

CMD ["npm", "run", "dev:docker"]
4 changes: 4 additions & 0 deletions apps/backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CLIENT_ID=""
CLIENT_SECRET=""
GIT_CLIENT_ID=""
GIT_CLIENT_SECRET=""
2 changes: 1 addition & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"dev": "vite --host",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
Expand Down
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3.8'

services:
app:
build: .
container_name: build-your-own
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres
ports:
- '3000:3000'
- '5173:5173'
depends_on:
db:
condition: service_healthy

db:
image: postgres:9.6
container_name: db
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: build-your-own
ports:
- '5432:5432'
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -d $$POSTGRES_DB -U $$POSTGRES_USER']
interval: 10s
timeout: 5s
retries: 5

volumes:
postgres-data:
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"dev": "turbo dev",
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx, js, jsx, md, mdx, css}\"",
"prepare": "husky install"
"prepare": "husky install",
"dev:docker": "npm run prisma:docker && npm run dev",
"prisma:docker": "cd packages/db && npx prisma migrate dev --skip-seed"
},
"lint-staged": {
"src/**/*.{ts,tsx,js,jsx,md,mdx,css}": [
Expand Down