Add healthcheck to Dockerfiles for API and web services
This commit is contained in:
1 parent
528cb70a79
commit
011a3f7790
2 files changed
+13
No files matched your search
@@ -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
|
||||
@@ -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/
|
||||
Reference in new issue
Block a user