Compare commits

..

2 Commits
main ... main

Author SHA1 Message Date
cf7266c9c2 Fixed wrong path 2026-05-15 15:49:54 +00:00
156bf8ea59 Optimize Dockerfile 2026-05-15 15:38:10 +00:00
2 changed files with 25 additions and 18 deletions

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
@ -47,7 +47,7 @@ steps:
# Repo clonen
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline
- cd EinfuehrungInDocker_Pipeline2
# Branch wechseln oder erstellen
- git checkout drone-artifacts || git checkout -b drone-artifacts

View File

@ -1,22 +1,29 @@
# Base-Image
FROM ubuntu:latest
FROM alpine:3.20 AS builder
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
RUN apk add --no-cache build-base
WORKDIR /app
COPY deployment.c .
RUN gcc -O2 -o deployment deployment.c
FROM alpine:3.20
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Arbeitsverzeichnis setzen
WORKDIR /app
# alles kopieren
COPY . .
COPY --from=builder /app/deployment /app/deployment
# Code kompilieren
RUN gcc -o deployment deployment.c
RUN mkdir -p /output && chown -R appuser:appgroup /app /output
# Verzeichnis für Ausgabe anlegen
RUN mkdir /output
USER appuser
# Ausgabe wird ins Container-Dateisystem geschrieben
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
VOLUME ["/output"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD test -f /output/output.txt || exit 1
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./deployment 10 >> /output/output.txt && tail -f /output/output.txt"]