fixed the healthcheck to actually work

This commit is contained in:
Aaro Koivukangas
2024-09-22 23:23:21 +03:00
committed by Aaro Koivukangas
parent 50dd4ea2aa
commit 8f35af289c
3 changed files with 15 additions and 0 deletions
+4
View File
@@ -29,6 +29,10 @@ RUN npm run build
# NOTE: Has to be alpine3.16 because newer versions have changed a dependency, causing Prisma to fail
FROM node:20-alpine3.16 AS node-run
# healthcheck needs this
USER root
RUN apk --no-cache add curl
# following mkdir needs root (for some reason)
RUN mkdir -p /usr/src/app/backend/prisma
RUN chown node:node /usr/src/app -R
+4
View File
@@ -7,4 +7,8 @@ router.get('/create-test-users', async (_req, res) => {
res.status(200).send()
})
router.get("/ping", async (_req, res) => {
return res.status(200).send()
})
export default router
+7
View File
@@ -19,6 +19,13 @@ services:
build:
context: .
dockerfile: ./backend/Dockerfile
target: node-run
healthcheck:
test: curl -f http://localhost:4000/test/ping || exit 1
start_period: 10s
interval: 30s
retries: 3
timeout: 15s
db-anon:
container_name: nowdb-db-anon