Skip to content

Commit

Permalink
Add nginx health check
Browse files Browse the repository at this point in the history
  • Loading branch information
NFarrington committed Mar 5, 2019
1 parent 0d95fe1 commit 443de6a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docker/Dockerfile
Expand Up @@ -20,11 +20,23 @@ RUN npm run production

FROM nginxinc/nginx-unprivileged:1.14-alpine AS nginx

USER root

RUN apk add --update --no-cache \
curl

COPY ./docker/nginx.conf /etc/nginx/nginx.conf
COPY ./docker/server.conf /etc/nginx/conf.d/default.conf

COPY --from=resources /home/node/app/public /var/www/html/public

USER nginx

HEALTHCHECK --start-period=15s --interval=30s --timeout=5s \
CMD curl -f http://localhost:8081/health || exit 1

EXPOSE 8080 8081

########################################

FROM php:7.3-fpm-alpine AS php-fpm
Expand Down
15 changes: 15 additions & 0 deletions docker/server.conf
Expand Up @@ -19,3 +19,18 @@ server {
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

server {
server_name localhost;
listen 8081 default_server;
listen [::]:8081 default_server;

location / {
return 200 "Port 8081\n";
}

location /health {
access_log off;
return 200 "healthy\n";
}
}

0 comments on commit 443de6a

Please sign in to comment.