Open jakeleventhal opened 8 months ago
I was also struggling to figure out how to run the studio out of docker. Would be nice if there was a prebuilt docker image that I could plug into my docker-compose that would bring the studio up.
+1 on the struggle.
drizzle-kit studio running in Docker container, with ports exposed:
Web fails to load, spamming console with errors:
is there no solution to this at all?
also, is this in development or do you guys run drizzle studio in production too with database?
would love to see your docker-compose.yml
as i'm trying to set this up.
drizzle-studio:
build:
context: ../../
dockerfile: ./path/to/Dockerfile
ports:
- 4983:4983
environment:
DATABASE_URL: postgresql://postgres:local@db:5432/postgres
DATABASE_DIRECT_URL: postgresql://postgres:local@db:5432/postgres
depends_on:
setup-db:
condition: service_completed_successfully
restart: always
command: drizzle-kit studio --host=0.0.0.0
FROM node:18.17.1-alpine
WORKDIR /app
# Install dependencies
COPY packages/artelo/database/package.json ./database-package.json
RUN npm install -g \
"pg@$(grep -E '"pg": "(.*)"' database-package.json | cut -d: -f2 | sed 's/,//' | xargs)" \
"drizzle-kit@$(grep -E '"drizzle-kit": "(.*)"' database-package.json | cut -d: -f2 | sed 's/,//' | xargs)" \
"drizzle-orm@$(grep -E '"drizzle-orm": "(.*)"' database-package.json | cut -d: -f2 | sed 's/,//' | xargs)"
RUN npm install "drizzle-orm@$(grep -E '"drizzle-orm": "(.*)"' database-package.json | cut -d: -f2 | sed 's/,//' | xargs)"
# Copy source files
COPY apps/myapp/package.json ./
COPY packages/myapp/database/drizzle.config.ts ./
COPY packages/myapp/database/src/schema.ts ./src/schema.ts
any news on this ?
For anyone who struggle with this issue, the solution is rather simple. You need to isolate the drizzle kit studio into own service then set network_mode: host
to that specific service, this will make the current service network not isolated from Docker host, which mean if you run drizzle-kit studio
then the default port 4983 will be used, and no need to declare port options anymore. I have test this in my project and success
For anyone who struggle with this issue, the solution is rather simple. You need to isolate the drizzle kit studio into own service then set
network_mode: host
to that specific service, this will make the current service network not isolated from Docker host, which mean if you rundrizzle-kit studio
then the default port 4983 will be used, and no need to declare port options anymore. I have test this in my project and success
Can you share your docker run
command or docker-compose.yml
file, please?
@nelsonprsousa yeah sure. You can check out my repo here, the latest commit is for running drizzle-studio with docker alone
@nelsonprsousa yeah sure. You can check out my repo here, the latest commit is for running drizzle-studio with docker alone
Thanks for sharing
Doesn't seem to work for me ¯_(ツ)_/¯
that is not simple at all
For anyone who struggle with this issue, the solution is rather simple. You need to isolate the drizzle kit studio into own service then set
network_mode: host
to that specific service, this will make the current service network not isolated from Docker host, which mean if you rundrizzle-kit studio
then the default port 4983 will be used, and no need to declare port options anymore. I have test this in my project and success
that is not simple at all
For me it actually works running a bun container in my WSL i can access drizzle studio in the Browser However when starting it this way it needs like 30s before it actually connects and when connected nearly every request gets a CORS Error only every 4 Requests or so the Request actually goes through
In docker, I specify the host as
--host=0.0.0.0
and it says i can access the studio at https://local.drizzle.studio?host=0.0.0.0; however, when 4983 is exposed, the only way to access the studio is by using https://local.drizzle.studio?host=localhost.It's a bit counterintuitive.