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
|
||||
FROM alpine:3.20 AS builder
|
||||
RUN apk add --no-cache build-base
|
||||
# Base-Image
|
||||
FROM alpine:latest
|
||||
|
||||
# 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
|
||||
COPY deployment.c .
|
||||
|
||||
# alles kopieren
|
||||
COPY . .
|
||||
|
||||
# Code kompilieren
|
||||
RUN gcc -o deployment deployment.c
|
||||
|
||||
# RUNTIME STAGE
|
||||
FROM alpine:3.20
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/deployment .
|
||||
# Verzeichnis für Ausgabe anlegen
|
||||
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"]
|
||||
Loading…
x
Reference in New Issue
Block a user