Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ RUN npm ci

ADD --chown=node:node . .
RUN npm run build
# Drop dev deps in-place after the build so the runtime stage can copy
# the already-compiled native modules instead of re-running node-gyp
# (which would need python3 + g++ in the runtime image again).
RUN npm prune --omit=dev


FROM node:18.19.1-alpine3.19
Expand All @@ -28,11 +32,10 @@ USER node
WORKDIR /home/node

COPY --from=builder /home/node/package.json /home/node/package-lock.json ./
COPY --from=builder /home/node/node_modules ./node_modules
COPY --from=builder /home/node/dist ./dist
COPY --from=builder /home/node/migration ./migration

RUN npm ci --omit=dev

EXPOSE 3000

CMD ["node", "dist/main.js"]
9 changes: 6 additions & 3 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ export class Configuration {
username: process.env.SQL_USERNAME,
password: process.env.SQL_PASSWORD,
database: process.env.SQL_DB,
ssl: {
rejectUnauthorized: false,
},
// Azure PostgreSQL Flexible Server enforces require_secure_transport=on
// and is the long-running default for this codebase, so SSL stays
// on by default. Set SQL_SSL=false on a host where the postgres peer
// does not speak TLS (e.g. the local api-postgres container in the
// DFX dfxdev/dfxprd LDS stack).
ssl: process.env.SQL_SSL === 'false' ? false : { rejectUnauthorized: false },
entities: ['dist/**/*.entity{.ts,.js}'],
autoLoadEntities: true,
synchronize: process.env.SQL_SYNCHRONIZE === 'true',
Expand Down
Loading