-
Notifications
You must be signed in to change notification settings - Fork 0
Docker compose #4
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| node_modules | ||
| Dockerfile* | ||
| docker-compose* | ||
| .dockerignore | ||
| .git | ||
| .gitignore | ||
| README.md | ||
| LICENSE | ||
| .vscode | ||
| Makefile | ||
| helm-charts | ||
| .env | ||
| .editorconfig | ||
| .idea | ||
| coverage* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,4 +42,7 @@ db/ | |
|
|
||
| # Dist folders | ||
| dist-static | ||
| dist-server | ||
| dist-server | ||
|
|
||
| # Docker Compose environment file | ||
| .env.docker | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| FROM oven/bun:1.3-alpine | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY package.json bun.lock ./ | ||
| RUN bun install --frozen-lockfile | ||
|
|
||
| COPY . . |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,3 +16,55 @@ services: | |
| interval: 10s | ||
| timeout: 5s | ||
| retries: 5 | ||
|
|
||
| # One-time task to run migrations | ||
| migrator: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.dev | ||
| command: bun drizzle-kit migrate | ||
| depends_on: | ||
| postgres: | ||
| condition: service_healthy | ||
| env_file: .env.docker | ||
| environment: | ||
| - DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-postgres} | ||
|
Comment on lines
+21
to
+31
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a ideja je, da maš prazno bazo k je prpravlena, če pa hočš staging bazo jo pa separately itak popolnoma povozš (torej ni nekih konfliktov?) |
||
|
|
||
| vite: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.dev | ||
| env_file: .env.docker | ||
| environment: | ||
| - WATCHPACK_POLLING=true | ||
| - DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-postgres} | ||
| command: bun run dev:app --host=0.0.0.0 | ||
| ports: | ||
| - "5173:5173" | ||
| volumes: | ||
| - .:/app # Edits on host are reflected in container | ||
| - /app/node_modules | ||
| depends_on: | ||
| postgres: | ||
| condition: service_healthy | ||
| migrator: | ||
| condition: service_completed_successfully | ||
|
|
||
| studio: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.dev | ||
| env_file: .env.docker | ||
| environment: | ||
| - DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-postgres} | ||
| command: bun run db:studio --port 4983 --host 0.0.0.0 | ||
| ports: | ||
| - "4983:4983" | ||
| volumes: | ||
| - .:/app # Edits on host are reflected in container | ||
| - /app/node_modules | ||
| depends_on: | ||
| postgres: | ||
| condition: service_healthy | ||
| migrator: | ||
| condition: service_completed_successfully | ||
|
Comment on lines
+20
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The definitions for x-common-build: &common-build
build:
context: .
dockerfile: Dockerfile.dev
services:
migrator:
<<: *common-build
# ... rest of migrator config
vite:
<<: *common-build
# ... rest of vite configYou can apply a similar pattern for other repeated sections like
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Literally no one can read this. I think we can leave as is.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what do you mean, arent we all yaml fans and experts |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,8 +4,8 @@ | |||||
| "type": "module", | ||||||
| "private": true, | ||||||
| "scripts": { | ||||||
| "dev": "infisical run -- bun -b concurrently --names \"DOCKER,APP\" -c \"blue,magenta\" \"bun run db:start\" \"bun run db:wait && bun run dev:app\"", | ||||||
| "dev:app": "concurrently --names \"VITE,STUDIO\" -c \"cyan,yellow\" \"vite dev\" \"bun run db:studio\"", | ||||||
| "dev": "infisical export --format=dotenv > .env.docker && docker compose -f docker-compose.dev.yml up", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works in bun.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow okay bun is smart
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a normal infisical run does not work? damn |
||||||
| "dev:app": "vite dev", | ||||||
| "db:studio": "drizzle-kit studio", | ||||||
| "db:start": "docker compose -f docker-compose.dev.yml up", | ||||||
| "db:wait": "bash -c 'until docker compose -f docker-compose.dev.yml exec -T postgres pg_isready -U ${POSTGRES_USER:-postgres} > /dev/null 2>&1; do sleep 1; done'", | ||||||
|
|
@@ -36,7 +36,6 @@ | |||||
| "@types/react": "^19.2.7", | ||||||
| "@types/react-dom": "^19.2.3", | ||||||
| "@vitejs/plugin-react": "^5.1.2", | ||||||
| "concurrently": "^9.0.0", | ||||||
| "react-router-dom": "^6.26.2", | ||||||
| "tw-animate-css": "^1.4.0", | ||||||
| "vite": "^7.3.0", | ||||||
|
|
@@ -90,4 +89,4 @@ | |||||
| "tailwindcss": "^4.1.18", | ||||||
| "zod": "^4.3.5" | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command
bun dev --buildis not the correct way to pass arguments to abunscript; this passes the--buildflag tobunitself, not the script. To pass arguments to the script, you should usebun dev -- --build. Please update the documentation to reflect the correct command usage.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works in bun.