forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Dockerfile aktualisiert
This commit is contained in:
parent
d525fcaaf4
commit
12c488ead8
29
Dockerfile
29
Dockerfile
@ -1,15 +1,26 @@
|
|||||||
# BUILDER STAGE
|
# Base-Image
|
||||||
FROM alpine:3.20 AS builder
|
FROM alpine:latest
|
||||||
RUN apk add --no-cache build-base
|
|
||||||
|
# Pakete installieren (build-base entspricht build-essential/gcc)
|
||||||
|
RUN apk update && apk add --no-cache \
|
||||||
|
build-base \
|
||||||
|
curl \
|
||||||
|
vim \
|
||||||
|
net-tools \
|
||||||
|
bash
|
||||||
|
|
||||||
|
# Arbeitsverzeichnis setzen
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY deployment.c .
|
|
||||||
|
# alles kopieren
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Code kompilieren
|
||||||
RUN gcc -o deployment deployment.c
|
RUN gcc -o deployment deployment.c
|
||||||
|
|
||||||
# RUNTIME STAGE
|
# Verzeichnis für Ausgabe anlegen
|
||||||
FROM alpine:3.20
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=builder /app/deployment .
|
|
||||||
RUN mkdir /output
|
RUN mkdir /output
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh", "-c"]
|
# Ausgabe wird ins Container-Dateisystem geschrieben
|
||||||
|
ENTRYPOINT ["/bin/bash", "-c"]
|
||||||
CMD ["./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