Skip to content

Commit

Permalink
Update dockerfile and add deployment config
Browse files Browse the repository at this point in the history
  • Loading branch information
WuBruno committed Oct 11, 2023
1 parent a8065d4 commit f0d863c
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
8 changes: 7 additions & 1 deletion products/pdt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry cargo build && \
mv /pdt/target/debug/pdt /pdt/build/

FROM gcr.io/distroless/cc-debian11:latest
FROM debian:bullseye-slim

RUN apt-get update -y && \

Check notice on line 19 in products/pdt/Dockerfile

View workflow job for this annotation

GitHub Actions / Trunk Check

hadolint(DL3015)

[new] Avoid additional packages by specifying `--no-install-recommends`

Check warning on line 19 in products/pdt/Dockerfile

View workflow job for this annotation

GitHub Actions / Trunk Check

hadolint(DL3008)

[new] Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check notice on line 19 in products/pdt/Dockerfile

View workflow job for this annotation

GitHub Actions / Trunk Check

hadolint(DL3009)

[new] Delete the apt-get lists after installing something
apt-get upgrade -y && \
apt-get install -y ca-certificates

COPY --from=builder /pdt/build/pdt /pdt

CMD ["/pdt", "test"]
53 changes: 53 additions & 0 deletions products/pdt/cd/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: pdt-pv
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 128Gi
storageClassName: standard
hostPath:
path: /tmp/pdt-pv
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pdt-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 128Gi
storageClassName: standard
volumeName: pdt-pv
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pdt
labels:
"app.kubernetes.io/name": "pdt"
spec:
replicas: 1
selector:
matchLabels:
"app.kubernetes.io/name": "pdt"
template:
metadata:
labels:
"app.kubernetes.io/name": "pdt"
spec:
containers:
- image: pdt:latest
name: pdt
imagePullPolicy: IfNotPresent
volumeMounts:
- name: pdt-pv
mountPath: /data
volumes:
- name: pdt-pv
persistentVolumeClaim:
claimName: pdt-pvc
5 changes: 4 additions & 1 deletion products/pdt/pdt/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ async fn main() -> Result<()> {
)
.await
}
Commands::Test => Ok(println!("Hello World")),
Commands::Test => {
println!("Hello World");
loop {}
}
}
}

0 comments on commit f0d863c

Please sign in to comment.