wait for db before starting the server (#14)
This commit is contained in:
parent
2703da66c8
commit
4cd243335d
@ -5,3 +5,4 @@
|
||||
!package.json
|
||||
!tsconfig.build.json
|
||||
!tsconfig.json
|
||||
!entrypoint.sh
|
||||
|
@ -12,17 +12,20 @@ RUN npm run build
|
||||
|
||||
FROM base as production
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y postgresql-client
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
USER node
|
||||
WORKDIR /home/node/app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY package.json package-lock.json entrypoint.sh ./
|
||||
RUN npm ci
|
||||
|
||||
COPY --from=production_buildstage /home/node/app/dist /home/node/app/dist
|
||||
|
||||
ENTRYPOINT ["npm", "run", "start:prod"]
|
||||
CMD ["./entrypoint.sh"]
|
||||
|
||||
FROM base as development
|
||||
|
||||
|
12
entrypoint.sh
Executable file
12
entrypoint.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Looking for the database ..."
|
||||
while ! pg_isready -q -d $STORAGE_URI
|
||||
do
|
||||
echo "Waiting for database."
|
||||
sleep 2
|
||||
done
|
||||
echo "Found database."
|
||||
echo "Starting the application..."
|
||||
|
||||
npm run start:prod
|
Loading…
x
Reference in New Issue
Block a user