Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aad5f91d49 | |||
| 12883602f8 | |||
| 4b4bcbf56e | |||
| 3df50360e6 | |||
| e7304fab26 | |||
| 34728990c3 | |||
| 5b71c9a2b7 | |||
| b9bea866a3 | |||
| ff4d035d4f |
@ -26,7 +26,7 @@ steps:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: security-scan
|
- name: security-scan
|
||||||
image: aquasec/trivy:latest
|
image: ghcr.io/aquasecurity/trivy:0.69.3
|
||||||
commands:
|
commands:
|
||||||
- trivy image --input image.tar --severity HIGH,CRITICAL --exit-code 1
|
- trivy image --input image.tar --severity HIGH,CRITICAL --exit-code 1
|
||||||
|
|
||||||
|
|||||||
43
Dockerfile
43
Dockerfile
@ -1,22 +1,35 @@
|
|||||||
# Base-Image
|
#schlankes Base-Images
|
||||||
FROM ubuntu:latest
|
FROM alpine:3.19 AS builder
|
||||||
|
|
||||||
# Pakete installieren
|
# Nur das nötigste
|
||||||
RUN apt-get update
|
RUN apk add --no-cache gcc musl-dev
|
||||||
RUN apt-get install -y build-essential gcc curl vim net-tools
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY deployment.c .
|
||||||
|
|
||||||
|
RUN gcc -o deployment deployment.c -static
|
||||||
|
|
||||||
|
# Nicht-root User anlegen
|
||||||
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||||
|
|
||||||
|
# Ausgabe-Verzeichnis anlegen und Rechte setzen
|
||||||
|
RUN mkdir /output && chown appuser:appgroup /output
|
||||||
|
|
||||||
# Arbeitsverzeichnis setzen
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# alles kopieren
|
# Nur das Binary aus dem Build-Stage kopieren
|
||||||
COPY . .
|
COPY --from=builder /app/deployment .
|
||||||
|
RUN chown appuser:appgroup /app/deployment
|
||||||
|
|
||||||
# Code kompilieren
|
# Volume für die Ausgabe
|
||||||
RUN gcc -o deployment deployment.c
|
VOLUME /output
|
||||||
|
|
||||||
# Verzeichnis für Ausgabe anlegen
|
# Als nicht-root User laufen
|
||||||
RUN mkdir /output
|
USER appuser
|
||||||
|
|
||||||
# Ausgabe wird ins Container-Dateisystem geschrieben
|
# Healthcheck: prüft ob das Binary vorhanden und ausführbar ist
|
||||||
ENTRYPOINT ["/bin/bash", "-c"]
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||||
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
|
CMD test -x /app/deployment || exit 1
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/deployment"]
|
||||||
|
CMD ["10"]
|
||||||
Loading…
x
Reference in New Issue
Block a user