Dockerfile optimiert
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
Ludwig Schramm 2026-05-13 14:40:03 +00:00
parent 1a0fcbbd12
commit d0c0343a4d
2 changed files with 29 additions and 15 deletions

View File

@ -1,2 +1,5 @@
.git
.gitignore
.drone.yml
README.md
*.tar
*.tar.gz

View File

@ -1,22 +1,33 @@
# Base-Image
FROM ubuntu:latest
FROM alpine:3.23 AS builder
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
RUN apk upgrade --no-cache && apk add --no-cache gcc musl-dev
# Arbeitsverzeichnis setzen
WORKDIR /app
# alles kopieren
COPY . .
# Code kompilieren
RUN gcc -o deployment deployment.c
RUN gcc -O2 -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"]
FROM alpine:3.23
RUN apk upgrade --no-cache
WORKDIR /app
COPY --from=builder /app/deployment /app/deployment
RUN addgroup -S appuser \
&& adduser -S appuser -G appuser \
&& mkdir /output \
&& chown -R appuser:appuser /app /output
VOLUME ["/output"]
USER appuser
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD test -s /output/output.txt || exit 1
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./deployment 10 2>&1 | tee /output/output.txt"]