Skip to content

Commit 40ca0b4

Browse files
fix: docker image requires postgres cert
1 parent 421db52 commit 40ca0b4

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Dockerfile

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
FROM oven/bun:1.1.29
2+
3+
RUN mkdir -p /etc/ssl/certs/
4+
RUN echo "$PGCERT" > /etc/ssl/certs/postgres.crt
5+
RUN chmod 600 /etc/ssl/certs/postgres.crt
6+
ENV PGCERT_PATH=/etc/ssl/certs/postgres.crt
7+
28
WORKDIR /app
39
COPY package.json bun.lockb ./
410
RUN bun install --production
511
COPY . .
612
RUN bun --bun run build
7-
CMD [ "bun", "run", ".output/server/index.mjs" ]
13+
CMD [ "bun", "run", ".output/server/index.mjs" ]

hono/db.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { drizzle } from 'drizzle-orm/node-postgres';
22
import { Pool } from 'pg';
3+
import fs from 'node:fs';
34

45
export const pool = new Pool({
56
user: process.env.PGUSER,
67
host: process.env.PGHOST,
78
database: process.env.PGDB,
89
password: process.env.PGPASSWORD,
910
port: +(process.env.PGPORT || 5432),
10-
ssl: true
11+
ssl: {
12+
rejectUnauthorized: true,
13+
ca: fs.readFileSync(process.env.PGCERT_PATH || '').toString()
14+
}
1115
});
1216

1317
export const db = drizzle(pool);

0 commit comments

Comments
 (0)