update dockerfile's
This commit is contained in:
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sh text eol=lf
|
||||
@@ -40,16 +40,11 @@ services:
|
||||
KEYCLOAK_JWKS_URL: ${KEYCLOAK_JWKS_URL:-}
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD",
|
||||
"node",
|
||||
"-e",
|
||||
"fetch('http://127.0.0.1:3000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
|
||||
]
|
||||
["CMD", "curl", "-fsS", "http://127.0.0.1:3000/health"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
start_period: 90s
|
||||
expose:
|
||||
- "3000"
|
||||
networks:
|
||||
|
||||
@@ -27,7 +27,7 @@ WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends openssl \
|
||||
&& apt-get install -y --no-install-recommends openssl ca-certificates curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=build /app/package*.json ./
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
set -e
|
||||
|
||||
PRISMA_BIN="./node_modules/.bin/prisma"
|
||||
if [ ! -f "$PRISMA_BIN" ]; then
|
||||
echo "Prisma CLI not found at $PRISMA_BIN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Applying database migrations..."
|
||||
npx prisma migrate deploy
|
||||
i=0
|
||||
while [ "$i" -lt 15 ]; do
|
||||
if "$PRISMA_BIN" migrate deploy; then
|
||||
break
|
||||
fi
|
||||
i=$((i + 1))
|
||||
if [ "$i" -eq 15 ]; then
|
||||
echo "prisma migrate deploy failed after 15 attempts"
|
||||
exit 1
|
||||
fi
|
||||
echo "Migrate failed or DB not ready; retrying in 2s ($i/15)..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "Starting NestJS..."
|
||||
exec node dist/main.js
|
||||
|
||||
Reference in New Issue
Block a user