Skip to content

Commit 15581c1

Browse files
committed
Reduced Docker Image size
1 parent 5a84be5 commit 15581c1

5 files changed

Lines changed: 47 additions & 21 deletions

File tree

docker/Dockerfile renamed to Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM python:3.7
1+
FROM python:3.7-alpine
22

33
RUN mkdir /app
44
WORKDIR /app
5-
ADD . /app/
5+
ADD ./app .
66
RUN pip install -r requirements.txt
77

88
EXPOSE 5000

kubernetes/deployment.yaml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
1-
apiVersion: v1
2-
kind: Service
3-
metadata:
4-
name: hello-python-service
5-
spec:
6-
selector:
7-
app: hello-python
8-
ports:
9-
- protocol: "TCP"
10-
port: 6000
11-
targetPort: 5000
12-
type: LoadBalancer
13-
14-
15-
---
16-
apiVersion: apps/v1beta1
1+
apiVersion: apps/v1
172
kind: Deployment
183
metadata:
194
name: hello-python
205
spec:
21-
replicas: 4
6+
replicas: 3
7+
selector:
8+
matchLabels:
9+
app: hello-python
2210
template:
2311
metadata:
2412
labels:
2513
app: hello-python
2614
spec:
2715
containers:
2816
- name: hello-python
29-
image: hello-python:latest
30-
imagePullPolicy: Never
17+
image: odytrice/hello-python:latest
3118
ports:
3219
- containerPort: 5000
20+
resources:
21+
requests:
22+
cpu: 50m
23+
memory: 50Mi
24+
limits:
25+
cpu: 100m
26+
memory: 150Mi
27+
28+

kubernetes/ingress.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: networking.k8s.io/v1beta1
2+
kind: Ingress
3+
metadata:
4+
name: hello-python-ingress
5+
spec:
6+
# tls:
7+
# - host: hello-python.dev.io
8+
# secretName: dev-io-tls
9+
rules:
10+
- host: hello-python.dev.io
11+
http:
12+
paths:
13+
- backend:
14+
serviceName: hello-python
15+
servicePort: 5000

kubernetes/kustomization.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace: hello-python
2+
resources:
3+
- deployment.yaml
4+
- service.yaml
5+
- ingress.yaml

kubernetes/service.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: hello-python
5+
spec:
6+
selector:
7+
app: hello-python
8+
ports:
9+
- protocol: "TCP"
10+
port: 5000

0 commit comments

Comments
 (0)