Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ COPY src/ ./src/

EXPOSE 8080

HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')" || exit 1

RUN adduser --disabled-password --gecos "" appuser
USER appuser

Expand Down
33 changes: 31 additions & 2 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
apiVersion: v1
kind: Namespace
metadata:
name: app
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: app
namespace: app
labels:
app: ai-coding-best-practice
annotations:
checkov.io/skip1: "CKV_K8S_43=image digest pinning is managed by the CI pipeline"
spec:
replicas: 2
selector:
Expand All @@ -14,14 +22,16 @@ spec:
labels:
app: ai-coding-best-practice
spec:
automountServiceAccountToken: false
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsUser: 10001
seccompProfile:
type: RuntimeDefault
containers:
- name: app
image: ghcr.io/trustedoss/ai-coding-best-practice:latest
image: ghcr.io/trustedoss/ai-coding-best-practice:1.0.0
imagePullPolicy: Always
ports:
- containerPort: 8080
securityContext:
Expand Down Expand Up @@ -53,10 +63,29 @@ apiVersion: v1
kind: Service
metadata:
name: app
namespace: app
spec:
selector:
app: ai-coding-best-practice
ports:
- port: 80
targetPort: 8080
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: app
namespace: app
spec:
podSelector:
matchLabels:
app: ai-coding-best-practice
policyTypes:
- Ingress
- Egress
ingress:
- ports:
- port: 8080
egress:
- {}
Loading