Skip to content

Commit 31b5c88

Browse files
committed
build: add a healthcheck
1 parent f2e8461 commit 31b5c88

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ RUN npm run build
2525
# Expose port
2626
EXPOSE 8080
2727

28+
# Add healthcheck to monitor app status.
29+
HEALTHCHECK --interval=30s --timeout=3s --start-period=45s --retries=3 \
30+
CMD node -e "require('http').get('http://localhost:8080', (res) => { process.exit(res.statusCode === 200 ? 0 : 1); })"
31+
2832
# Start the server
2933
CMD ["npm", "start"]

0 commit comments

Comments
 (0)