forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Compare commits
No commits in common. "main" and "main" have entirely different histories.
35
Dockerfile
35
Dockerfile
@ -1,27 +1,22 @@
|
|||||||
|
# Base-Image
|
||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
FROM alpine:latest AS builder
|
# Pakete installieren
|
||||||
|
RUN apt-get update
|
||||||
RUN apk add --no-cache build-base
|
RUN apt-get install -y build-essential gcc curl vim net-tools
|
||||||
|
|
||||||
WORKDIR /build
|
|
||||||
COPY deployment.c .
|
|
||||||
|
|
||||||
|
|
||||||
RUN gcc -static -o deployment deployment.c
|
|
||||||
|
|
||||||
FROM alpine:latest
|
|
||||||
|
|
||||||
|
# Arbeitsverzeichnis setzen
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /build/deployment .
|
|
||||||
|
|
||||||
RUN adduser -D appuser && \
|
# alles kopieren
|
||||||
mkdir /output && \
|
COPY . .
|
||||||
chown -R appuser:appuser /app /output
|
|
||||||
|
|
||||||
USER appuser
|
# Code kompilieren
|
||||||
|
RUN gcc -o deployment deployment.c
|
||||||
|
|
||||||
VOLUME /output
|
# Verzeichnis für Ausgabe anlegen
|
||||||
|
RUN mkdir /output
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=5s CMD test -f /output/output.txt || exit 1
|
# Ausgabe wird ins Container-Dateisystem geschrieben
|
||||||
|
ENTRYPOINT ["/bin/bash", "-c"]
|
||||||
CMD ["sh", "-c", "./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
|
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
|
||||||
Loading…
x
Reference in New Issue
Block a user