-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: docker image requires postgres cert
- Loading branch information
1 parent
421db52
commit 40ca0b4
Showing
2 changed files
with
12 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
FROM oven/bun:1.1.29 | ||
|
||
RUN mkdir -p /etc/ssl/certs/ | ||
RUN echo "$PGCERT" > /etc/ssl/certs/postgres.crt | ||
RUN chmod 600 /etc/ssl/certs/postgres.crt | ||
ENV PGCERT_PATH=/etc/ssl/certs/postgres.crt | ||
|
||
WORKDIR /app | ||
COPY package.json bun.lockb ./ | ||
RUN bun install --production | ||
COPY . . | ||
RUN bun --bun run build | ||
CMD [ "bun", "run", ".output/server/index.mjs" ] | ||
CMD [ "bun", "run", ".output/server/index.mjs" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import { drizzle } from 'drizzle-orm/node-postgres'; | ||
import { Pool } from 'pg'; | ||
import fs from 'node:fs'; | ||
|
||
export const pool = new Pool({ | ||
user: process.env.PGUSER, | ||
host: process.env.PGHOST, | ||
database: process.env.PGDB, | ||
password: process.env.PGPASSWORD, | ||
port: +(process.env.PGPORT || 5432), | ||
ssl: true | ||
ssl: { | ||
rejectUnauthorized: true, | ||
ca: fs.readFileSync(process.env.PGCERT_PATH || '').toString() | ||
} | ||
}); | ||
|
||
export const db = drizzle(pool); |