Improve deployment security
This commit is contained in:
parent
a7b1891501
commit
9f8b2e7711
@ -1,4 +1,4 @@
|
|||||||
FROM reg.dev.krd/hub.docker/library/node:16 as build-stage
|
FROM node:16 as build-stage
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@ -13,8 +13,7 @@ COPY *.js ./
|
|||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM reg.dev.krd/hub.docker/library/nginx:1.20-alpine AS production
|
FROM bitnami/nginx:1.20 AS production
|
||||||
|
|
||||||
COPY --from=build-stage /app/build /usr/share/nginx/html
|
COPY --from=build-stage /app/build /app
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
EXPOSE 8080
|
||||||
EXPOSE 80
|
|
||||||
|
|||||||
@ -17,6 +17,11 @@ spec:
|
|||||||
app: dsm-client
|
app: dsm-client
|
||||||
|
|
||||||
spec:
|
spec:
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
fsGroup: 1001
|
||||||
|
sysctls: []
|
||||||
|
|
||||||
containers:
|
containers:
|
||||||
- name: dsm-client
|
- name: dsm-client
|
||||||
image: IMAGE
|
image: IMAGE
|
||||||
@ -28,11 +33,26 @@ spec:
|
|||||||
memory: 32Mi
|
memory: 32Mi
|
||||||
cpu: 5m
|
cpu: 5m
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- name: http
|
||||||
|
containerPort: 8080
|
||||||
|
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: http
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
|
||||||
|
readinessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: http
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 3
|
||||||
|
failureThreshold: 3
|
||||||
|
successThreshold: 1
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 5
|
||||||
periodSeconds: 15
|
|
||||||
httpGet:
|
securityContext:
|
||||||
path: /health
|
runAsUser: 1001
|
||||||
port: 80
|
runAsNonRoot: true
|
||||||
|
|||||||
@ -10,4 +10,5 @@ spec:
|
|||||||
app: dsm-client
|
app: dsm-client
|
||||||
ports:
|
ports:
|
||||||
- port: 80
|
- port: 80
|
||||||
|
targetPort: 8080
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
|
|||||||
15
nginx.conf
15
nginx.conf
@ -1,15 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /health {
|
|
||||||
access_log off;
|
|
||||||
default_type text/plain;
|
|
||||||
return 200 "Healthy\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user