tursodatabase / tursodatabase/libsql

Unable to run on `oven/bun:distroless` docker image

Open
#1,558 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

When I try and run a libsql on a Bun distroless image I get an error: TypeError: libgcc_s.so.1: cannot open shared object file: No such file or directory

I assume that the distroless is missing some native binaries that libsql relies on?

Minimal repro:

index.ts

import { drizzle } from "drizzle-orm/libsql";
import { createClient } from "@libsql/client";
import * as schema from "./schema";

const client = createClient({
  url: `file:${__dirname}/sqlite.db`,
});

const db = drizzle<typeof schema>(client, { schema });

const res = await db.select().from(schema.books);

console.log(res);

drizzle.config.ts

import { defineConfig } from "drizzle-kit";

export default defineConfig({
  dialect: "sqlite",

  schema: "./schema.ts",
  out: "./drizzle",

  dbCredentials: {
    url: "sqlite.db",
  },
});

schema.ts

import { sqliteTable, text } from "drizzle-orm/sqlite-core";

const books = sqliteTable("books", {
  id: text("id").notNull().primaryKey(),
  title: text("title").notNull(),
  description: text("description"),
});

export { books };

Dockerfile

FROM oven/bun:distroless
COPY dist .
ENTRYPOINT ["bun", "./index.js"]
  1. Run bun build index.ts --outdir dist --target bun
  2. Run docker build . -t repro
  3. Run docker run -p 8080:8080 test

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Dockerfile and Minimal repro, then run the three listed build and container commands to reproduce the missing libgcc_s.so.1 error. Trace which runtime dependency is unavailable in oven/bun:distroless; done means the reproduced Bun libsql program runs successfully in that image.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, docker, sqlite, typescript
Domain
databases, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.