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
- name: security-scan
image: ghcr.io/aquasecurity/trivy:0.69.3
image: aquasec/trivy:latest
commands:
- trivy image --input image.tar --severity HIGH,CRITICAL --exit-code 1
+29 -13
View File
@@ -1,22 +1,38 @@
# Base-Image
FROM ubuntu:latest
# Base-Image - Alpine statt Ubuntu
FROM alpine:latest AS build
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
# Build-Tools installieren
RUN apk add --no-cache gcc musl-dev
# Arbeitsverzeichnis setzen
WORKDIR /app
# alles kopieren
COPY . .
# Code kompilieren
# Code kopieren und kompilieren
COPY deployment.c .
RUN gcc -o deployment deployment.c
# Verzeichnis für Ausgabe anlegen
RUN mkdir /output
# Finales schlankes Image
FROM alpine:latest
# Ausgabe wird ins Container-Dateisystem geschrieben
ENTRYPOINT ["/bin/bash", "-c"]
# Nicht als root laufen
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"]