{"id":19777156,"url":"https://github.com/fariosofernando/Cookbook-dockerizing_bun_with_prisma-","last_synced_at":"2025-09-17T23:31:37.030Z","repository":{"id":246297223,"uuid":"820672270","full_name":"hi-im-aurelio/Cookbook-dockerizing_bun_with_prisma-","owner":"hi-im-aurelio","description":"Detailed recipe for Dockerizing applications that use Bun with Prisma efficiently inside Docker containers.","archived":false,"fork":false,"pushed_at":"2024-06-27T00:37:57.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-12T05:28:01.831Z","etag":null,"topics":["bun","coockbook","docker","docker-compose","prisma"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hi-im-aurelio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-27T00:25:38.000Z","updated_at":"2024-10-24T08:54:52.000Z","dependencies_parsed_at":"2024-06-27T03:57:10.445Z","dependency_job_id":null,"html_url":"https://github.com/hi-im-aurelio/Cookbook-dockerizing_bun_with_prisma-","commit_stats":null,"previous_names":["fariosofernando/cookbook-dockerizing_bun_with_prisma-","hi-im-aurelio/cookbook-dockerizing_bun_with_prisma-"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hi-im-aurelio%2FCookbook-dockerizing_bun_with_prisma-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hi-im-aurelio%2FCookbook-dockerizing_bun_with_prisma-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hi-im-aurelio%2FCookbook-dockerizing_bun_with_prisma-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hi-im-aurelio%2FCookbook-dockerizing_bun_with_prisma-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hi-im-aurelio","download_url":"https://codeload.github.com/hi-im-aurelio/Cookbook-dockerizing_bun_with_prisma-/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233430211,"owners_count":18675050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bun","coockbook","docker","docker-compose","prisma"],"created_at":"2024-11-12T05:23:24.929Z","updated_at":"2025-09-17T23:31:31.374Z","avatar_url":"https://github.com/hi-im-aurelio.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dockerizing Bun with Prisma\n\nThis README provides a detailed recipe for setting up a Docker environment that uses Bun and Prisma. This configuration is useful to overcome known issues when running `bun` and `prisma` inside Docker containers.\n\n## Known issues\n\nRunning Bun with Prisma in Docker containers can be challenging due to Prisma-specific dependencies on the Node API. Known issues include:\n\n- [Bun doesn't run prisma generate or prisma migrate inside docker containers or WSL](https://github.com/oven-sh/bun/issues/5320)\n- [bunx prisma generate breaking](https://github.com/prisma/prisma/issues/21277)\n\nThese issues can result in errors when running commands like `prisma generate` or `prisma migrate` in Docker containers. Or even the prism engine which depends on the Node.js API.\n\nThis cookbook was written with a lot of anger, I hope it makes you happy.\n\n## Solution\n\nBelow is the Dockerfile recipe for setting up a container that uses Bun and Prisma without any problems.\n\n### Dockerfile\n\n```Dockerfile\n# Use the official Bun image | Use a imagem oficial do Bun\nFROM oven/bun:1-debian\n\nWORKDIR /app\n\n# Update apt | Atualizar o apt\nRUN apt-get update\n\n# Install curl using apt | Instalar o curl usando o apt\nRUN apt-get install -y curl\n\n# Add NodeSource repository and install Node.js | Adicionar repositório NodeSource e instalar Node.js\nRUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \u0026\u0026 \\\n  apt-get install -y nodejs\n\n# Set environment variable | Definir variável de ambiente\nENV NODE_ENV=development\n\n# Copy package.json and bun.lockb | Copiar package.json e bun.lockb\nCOPY package.json bun.lockb /app/\n\n# Copy prisma directory before installing dependencies | Copiar o diretório prisma antes de instalar as dependências\nCOPY prisma /app/prisma\n\n# Install dependencies and generate Prisma client | Instalar dependências e gerar cliente Prisma\nRUN set -e \u0026\u0026 \\\n  bun install \u0026\u0026 \\\n  bun run generate\n\n# Copy the rest of the application | Copiar o restante da aplicação\nCOPY . /app/\n\n# Expose port 3002 | Expor a porta 3002\nEXPOSE 3002\n\n# Define entrypoint | Definir entrypoint\nENTRYPOINT [\"bun\", \"run\", \"dev\"]\n```\n\n### Project Structure\n\nEnsure that your project structure is organized as follows:\n\n```\n/app\n  ├── prisma/\n  │   └── schema.prisma\n  ├── package.json\n  ├── bun.lockb\n  ├── Dockerfile\n  ├── ...\n```\n\n### package.json\n\nMake sure your `package.json` contains the necessary script to generate the Prisma client:\n\n```json\n{\n  \"scripts\": {\n    \"generate\": \"bun prisma generate --schema=prisma/schema.prisma\"\n  }\n}\n```\n\n### Docker commands\n\nTo build and run your container, use the following commands:\n\n```sh\n# Build the Docker image | Construir a imagem Docker\ndocker-compose -f docker-compose.dev.yml build --no-cache\n\n# Run the Docker container | Rodar o contêiner Docker\ndocker-compose -f docker-compose.dev.yml up\n```\n\nWith this setup, you should be able to build and run your Bun project with Prisma inside a Docker container without encountering the known issues mentioned above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffariosofernando%2FCookbook-dockerizing_bun_with_prisma-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffariosofernando%2FCookbook-dockerizing_bun_with_prisma-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffariosofernando%2FCookbook-dockerizing_bun_with_prisma-/lists"}