Compare commits

..
1 Commits
Author SHA1 Message Date
chilaban95240 763719ee64 Dockerfile aktualisiert 2026-04-11 11:41:06 +00:00
2 changed files with 30 additions and 14 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ steps:
fi fi
- name: security-scan - name: security-scan
image: ghcr.io/aquasecurity/trivy:0.69.3 image: aquasec/trivy:latest
commands: commands:
- trivy image --input image.tar --severity HIGH,CRITICAL --exit-code 1 - trivy image --input image.tar --severity HIGH,CRITICAL --exit-code 1
+29 -13
View File
@@ -1,22 +1,38 @@
# Base-Image # Base-Image - Alpine statt Ubuntu
FROM ubuntu:latest FROM alpine:latest AS build
# Pakete installieren # Build-Tools installieren
RUN apt-get update RUN apk add --no-cache gcc musl-dev
RUN apt-get install -y build-essential gcc curl vim net-tools
# Arbeitsverzeichnis setzen # Arbeitsverzeichnis setzen
WORKDIR /app WORKDIR /app
# alles kopieren # Code kopieren und kompilieren
COPY . . COPY deployment.c .
# Code kompilieren
RUN gcc -o deployment deployment.c RUN gcc -o deployment deployment.c
# Verzeichnis für Ausgabe anlegen # Finales schlankes Image
RUN mkdir /output FROM alpine:latest
# Ausgabe wird ins Container-Dateisystem geschrieben # Nicht als root laufen
ENTRYPOINT ["/bin/bash", "-c"] RUN adduser -D appuser
WORKDIR /app
# Nur das Binary kopieren
COPY --from=build /app/deployment .
# Ausgabeverzeichnis anlegen und Rechte setzen
RUN mkdir /output && chown appuser /output
# Volume für Ausgabe
VOLUME /output
# User wechseln
USER appuser
# Healthcheck
HEALTHCHECK --interval=30s --timeout=5s CMD pgrep deployment || exit 1
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"] CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]