Compare commits

...

6 Commits
main ... main

Author SHA1 Message Date
98e948e360 apk update for security fix 2026-04-11 14:06:05 +02:00
ed7cef53c4 .drone.yml aktualisiert 2026-04-11 11:57:17 +00:00
2c7d8c2f60 .drone.yml aktualisiert 2026-04-11 11:55:25 +00:00
1ff64cdbad multistage 2026-04-11 13:48:44 +02:00
7dac79062f merge upstream 2026-04-11 11:46:34 +00:00
df9f066b7c changed parent image 2026-04-11 13:33:55 +02:00
2 changed files with 27 additions and 18 deletions

View File

@ -46,8 +46,8 @@ steps:
#- git remote set-url origin https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2 #- git remote set-url origin https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2
# Repo clonen # Repo clonen
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git - git clone https://git.efi.th-nuernberg.de/gitea/weigmi87303/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline - cd EinfuehrungInDocker_Pipeline2
# Branch wechseln oder erstellen # Branch wechseln oder erstellen
- git checkout drone-artifacts || git checkout -b drone-artifacts - git checkout drone-artifacts || git checkout -b drone-artifacts

View File

@ -1,22 +1,31 @@
# Base-Image # ── Stage 1: Build ───────────────────────────────────────────────────────────
FROM ubuntu:latest FROM gcc:14-bookworm AS builder
# Pakete installieren WORKDIR /build
RUN apt-get update COPY deployment.c .
RUN apt-get install -y build-essential gcc curl vim net-tools
# Arbeitsverzeichnis setzen RUN gcc -O2 -static -o deployment deployment.c
# ── Stage 2: Runtime ─────────────────────────────────────────────────────────
FROM alpine:3.21
# Alle Pakete auf neuesten Stand bringen → patcht libcrypto3/libssl3 auf 3.3.7-r0
RUN apk update && apk upgrade --no-cache
# Nicht-root-User anlegen
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Output-Verzeichnis mit korrekten Rechten anlegen
RUN mkdir /output && chown appuser:appgroup /output
COPY --from=builder /build/deployment /app/deployment
VOLUME ["/output"]
USER appuser
WORKDIR /app WORKDIR /app
# alles kopieren HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
COPY . . CMD test -f /output/output.txt && test -s /output/output.txt || exit 1
# Code kompilieren ENTRYPOINT ["/bin/sh", "-c"]
RUN gcc -o deployment deployment.c
# Verzeichnis für Ausgabe anlegen
RUN mkdir /output
# Ausgabe wird ins Container-Dateisystem geschrieben
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"] CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]