Skip to content

Commit

Permalink
1 docker update and reintegration point
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEhler committed Dec 24, 2023
1 parent 4d1c912 commit d4614e6
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 4 deletions.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.6-slim

RUN apt-get clean \
&& apt-get -y update

RUN apt-get -y install \
nginx \
python3-dev \
build-essential

WORKDIR /app

COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt --src /usr/local/src

COPY . .

EXPOSE 5000
CMD [ "python", "run.py" ]
45 changes: 45 additions & 0 deletions manifests/app_deployment_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: flaskapi-deployment
labels:
app: flaskapi
spec:
replicas: 3
selector:
matchLabels:
app: flaskapi
template:
metadata:
labels:
app: flaskapi
spec:
containers:
- name: flaskapi
image: flask-api
imagePullPolicy: Never
ports:
- containerPort: 5000
env:
- name: db_root_password
valueFrom:
secretKeyRef:
name: flaskapi-secrets
key: db_root_password
- name: db_name
value: flaskapi

---
apiVersion: v1
kind: Service
metadata:
name: flask-service
spec:
ports:
- port: 5000
protocol: TCP
targetPort: 5000
selector:
app: flaskapi
type: LoadBalancer
1 change: 1 addition & 0 deletions manifests/deployment_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.
8 changes: 8 additions & 0 deletions manifests/flask_secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Secret
metadata:
name: flaskapi-secrets
type: Opaque
data:
db_root_password: <Insert your password here>
27 changes: 27 additions & 0 deletions manifests/pv_pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
alembic==1.11.3
alembic==1.13.1
asgiref==3.7.2
azure-core==1.26.4
azure-storage-blob==12.16.0
backports.zoneinfo;python_version<"3.9"
backports.zoneinfo==0.2.1
bcrypt==4.0.1
blinker==1.6.2
branca==0.6.0
Expand Down Expand Up @@ -39,7 +39,7 @@ mysql-connector-python==8.1.0
mysqlclient==2.2.0
numpy==1.24.3
pandas==2.0.1
# pkg_resources==0.0.0
pkg_resources==0.0.0
protobuf==4.21.12
pycparser==2.21
PyMySQL==1.1.0
Expand Down
4 changes: 3 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@

app.secret_key = Config.SECRET_KEY # Set a secret key for flash messages

# if __name__ == '__main__':
# app.run(debug=True)
if __name__ == '__main__':
app.run(debug=True)
app.run(host='0.0.0.0', port=5000, debug=True)

0 comments on commit d4614e6

Please sign in to comment.