Skip to content
This repository has been archived by the owner on Dec 4, 2022. It is now read-only.

Commit

Permalink
Added Rolling Update and Liveness Probe
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Miller committed Nov 15, 2019
1 parent 33fd627 commit 43e756e
Show file tree
Hide file tree
Showing 5 changed files with 1,469 additions and 771 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.next/
node_modules/
out/
nginx.conf
19 changes: 14 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
FROM node:carbon as builder
FROM node:erbium as builder

WORKDIR /app

ADD . .

ENV NODE_ENV production

RUN npm install
RUN npm install -g yarn

ADD package.json .

RUN npm run build
ADD yarn.lock .

RUN npm run export
RUN yarn install

ADD . .

RUN yarn build

RUN yarn export

FROM nginx:1.17.5-alpine

ADD nginx.conf /etc/nginx/nginx.conf

COPY --from=builder /app/out/ /usr/share/nginx/html/

14 changes: 14 additions & 0 deletions cloud-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ metadata:
spec:
replicas: 2
revisionHistoryLimit: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
selector:
matchLabels:
app: home
Expand All @@ -23,6 +27,16 @@ spec:
ports:
- containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 3
periodSeconds: 3
lifecycle:
preStop:
exec:
command: ["/usr/sbin/nginx","-s","quit"]
---
apiVersion: v1
kind: Service
Expand Down
34 changes: 34 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
user nginx;
worker_processes auto;

pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

location /health {
return 200 'alive';
add_header Content-Type text/plain;
}
}
}
Loading

0 comments on commit 43e756e

Please sign in to comment.