Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Add healthcheck to Dockerfiles for API and web services

Georgiy Sitnikov011a3f7790ba
diff --git a/api/Dockerfile b/api/Dockerfile
index ee69c8a71..b3b767226 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -3,6 +3,14 @@ WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install --omit=dev && npm cache clean --force
COPY server.js ./
+
ENV NODE_ENV=production
+ENV PORT=3000
+
EXPOSE 3000
CMD ["node", "server.js"]
+
+HEALTHCHECK --interval=5m \
+ --timeout=5s \
+ --retries=3 \
+ CMD wget --spider -q http://localhost:${PORT}/api/config
\ No newline at end of file
diff --git a/web/Dockerfile b/web/Dockerfile
index 9b30e63a9..aa33b8cd7 100644
--- a/web/Dockerfile
+++ b/web/Dockerfile
@@ -18,3 +18,8 @@ FROM nginx:alpine
COPY web/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
# exercise media (img/gif) is mounted at runtime from the media volume
+
+HEALTHCHECK --interval=5m \
+ --timeout=5s \
+ --retries=3 \
+ CMD curl -fs http://localhost/