mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Frontend dev dockerfile: Check if node_modules exist and install if not on startup
This commit is contained in:
@@ -44,16 +44,16 @@ export const testDbConnection = async () => {
|
||||
return false
|
||||
}
|
||||
}
|
||||
const maxAttempts = 20
|
||||
const maxAttempts = 25
|
||||
let attempts = 0
|
||||
while (attempts < maxAttempts) {
|
||||
const success = await tryDbConnection()
|
||||
if (success) {
|
||||
return
|
||||
}
|
||||
logger.info(`Trying again in 6 seconds, attempt ${attempts} / ${maxAttempts}`)
|
||||
logger.info(`Trying again in 4 seconds, attempt ${attempts} / ${maxAttempts}`)
|
||||
attempts++
|
||||
await sleep(6000)
|
||||
await sleep(4000)
|
||||
}
|
||||
logger.error(`Attempted ${maxAttempts} times, but database connection could not be established`)
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ COPY package.json ./
|
||||
|
||||
COPY package-lock.json ./
|
||||
|
||||
RUN npm ci
|
||||
|
||||
EXPOSE 5173
|
||||
|
||||
CMD ["npm", "run", "dev", "--", "--host"]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev": "[ -d node_modules ] && npx vite || npm ci && npx vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
|
||||
Reference in New Issue
Block a user