Fix database connector, use alpine node image

This commit is contained in:
Evert Prants 2024-06-12 19:33:28 +03:00
parent 3e47e2e900
commit 2df11c8091
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
# Build the application with a specific environment # Build the application with a specific environment
FROM node:20 AS builder FROM node:20-alpine AS builder
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -9,7 +9,7 @@ RUN npm ci
RUN npm run build RUN npm run build
# Create the executor image # Create the executor image
FROM node:20 FROM node:20-alpine
WORKDIR /app WORKDIR /app

View File

@ -3,7 +3,7 @@ import { drizzle } from 'drizzle-orm/mysql2';
import mysql from 'mysql2/promise'; import mysql from 'mysql2/promise';
import * as schema from './schema'; import * as schema from './schema';
const { DATABASE_DB, DATABASE_HOST, DATABASE_PASS } = env; const { DATABASE_DB, DATABASE_HOST, DATABASE_PASS, DATABASE_USER } = env;
export class DB { export class DB {
static mysqlConnection: mysql.Connection; static mysqlConnection: mysql.Connection;
@ -12,7 +12,7 @@ export class DB {
static async init() { static async init() {
DB.mysqlConnection = await mysql.createConnection({ DB.mysqlConnection = await mysql.createConnection({
host: DATABASE_HOST, host: DATABASE_HOST,
user: DATABASE_PASS, user: DATABASE_USER,
password: DATABASE_PASS, password: DATABASE_PASS,
database: DATABASE_DB database: DATABASE_DB
}); });