swicht from debian-slim to alpine because of CI Vulnerabilities
This commit is contained in:
parent
7aed6a2669
commit
db3dfa6b4e
21
Dockerfile
21
Dockerfile
@ -3,12 +3,10 @@
|
||||
# ============================================
|
||||
# Build Stage
|
||||
# ============================================
|
||||
FROM debian:bookworm-slim AS build
|
||||
FROM alpine:3.20 AS build
|
||||
|
||||
# Nur die benötigten Pakete installieren und danach Metadaten löschen die man nur für die INstallation braucht
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends gcc libc6-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
# Nur die benötigten Pakete installieren mit --no-chache
|
||||
RUN apk add --no-cache gcc musl-dev
|
||||
|
||||
# WORKDIR setzen
|
||||
WORKDIR /app
|
||||
@ -22,18 +20,16 @@ RUN gcc -o deployment deployment.c
|
||||
# ============================================
|
||||
# Runtime Stage
|
||||
# ============================================
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
FROM alpine:3.20 AS runtime
|
||||
|
||||
# Curl für den HEALTHCHECK
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN apk add --no-cache curl
|
||||
|
||||
# Das output directory erstellen
|
||||
RUN mkdir -p /output
|
||||
|
||||
# User ohne Root-Rechte erstellen
|
||||
RUN useradd -m app
|
||||
RUN adduser -D app
|
||||
|
||||
# Der User app braucht die Rechte für den Ordner output
|
||||
RUN chown -R app:app /output
|
||||
@ -51,10 +47,11 @@ VOLUME ["/output"]
|
||||
USER app
|
||||
|
||||
# Programm starten
|
||||
ENTRYPOINT ["/bin/bash", "-c"]
|
||||
ENTRYPOINT ["/bin/sh", "-c"]
|
||||
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
|
||||
|
||||
# prüfen ob output.txt existiert und aktualisiert wird
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD test -f /output/output.txt && test $(find /output/output.txt -mmin -1) && echo "healthy" || exit 1
|
||||
CMD [ -f /output/output.txt ] && \
|
||||
[ $(find /output/output.txt -mmin -1 | wc -l) -gt 0 ] || exit 1
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user