diff --git a/Dockerfile b/Dockerfile index 0534ec7..089cd0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,10 @@ # Base-Image -FROM ubuntu:latest AS build_stage +FROM alpine AS build_stage # Pakete installieren -RUN apt-get update -RUN apt-get install -y build-essential gcc curl vim net-tools +RUN apk update +RUN apk add --no-cache build-base gcc curl vim net-tools +RUN apk add --no-cache bash # Arbeitsverzeichnis setzen WORKDIR /app @@ -18,13 +19,23 @@ FROM alpine AS runtime RUN apk add --no-cache bash +#RUN adduser -u 1000 -g 1000 -D -s /bin/bash fabian + WORKDIR /app COPY --from=build_stage /app/deployment . # Verzeichnis für Ausgabe anlegen -RUN mkdir /output +#USER root +RUN mkdir /output && chown 1000:1000 /output +#USER fabian +USER 1000:1000 + +VOLUME ["/output"] + +#Healthcheck +HEALTHCHECK --interval=30s CMD test -f /output/output.txt || exit 1 # Ausgabe wird ins Container-Dateisystem geschrieben ENTRYPOINT ["/bin/bash", "-c"] -CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"] \ No newline at end of file +CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]