update
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Peter Kessler 2026-04-11 13:21:41 +02:00
parent dea458fcb2
commit 0efcaaa378
2 changed files with 59 additions and 8 deletions

View File

@ -1,9 +1,11 @@
# Base-Image # Base-Image
FROM ubuntu:latest FROM debian:bookworm-slim AS builder
# Pakete installieren # Pakete installieren
RUN apt-get update RUN apt-get update && apt-get install -y --no-install-recommends \
RUN apt-get install -y build-essential gcc curl vim net-tools gcc \
libc6-dev \
&& rm -rf /var/lib/apt/lists/*
# Arbeitsverzeichnis setzen # Arbeitsverzeichnis setzen
WORKDIR /app WORKDIR /app
@ -12,11 +14,38 @@ WORKDIR /app
COPY . . COPY . .
# Code kompilieren # Code kompilieren
RUN gcc -o deployment deployment.c RUN gcc -O2 -o deployment deployment.c
# Base-Image
FROM debian:bookworm-slim
# Pakete installieren
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Arbeitsverzeichnis setzen
WORKDIR /app
# kompiliertes Programm kopieren
COPY --from=builder /app/deployment /app/deployment
# Verzeichnis für Ausgabe anlegen # Verzeichnis für Ausgabe anlegen
RUN mkdir /output RUN mkdir /output \
&& useradd -m appuser \
&& chown -R appuser:appuser /app /output
# Ausgabe wird ins Container-Dateisystem geschrieben # Datavolume für Ausgabe
ENTRYPOINT ["/bin/bash", "-c"] VOLUME ["/output"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
# nicht als root laufen
USER appuser
# Healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD test -s /output/output.txt || exit 1
# Ausgabe wird ins Volume geschrieben
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["touch /output/output.txt && ./deployment 10 >> /output/output.txt & tail -f /output/output.txt"]

22
Dockerfile2 Normal file
View File

@ -0,0 +1,22 @@
# Base-Image
FROM ubuntu:latest
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
# Arbeitsverzeichnis setzen
WORKDIR /app
# alles kopieren
COPY . .
# Code kompilieren
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"]