forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Dockerfile aktualisiert
This commit is contained in:
parent
bcd8ec8c3e
commit
f3769cb32c
27
Dockerfile
27
Dockerfile
@ -1,22 +1,17 @@
|
|||||||
# Base-Image
|
# BUILDER STAGE
|
||||||
FROM ubuntu:latest
|
FROM alpine:3.20 AS builder
|
||||||
|
RUN apk add --no-cache build-base
|
||||||
# Pakete installieren
|
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install -y build-essential gcc curl vim net-tools
|
|
||||||
|
|
||||||
# Arbeitsverzeichnis setzen
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY deployment.c .
|
||||||
# alles kopieren
|
# Wir bauen hier noch "normal"
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Code kompilieren
|
|
||||||
RUN gcc -o deployment deployment.c
|
RUN gcc -o deployment deployment.c
|
||||||
|
|
||||||
# Verzeichnis für Ausgabe anlegen
|
# RUNTIME STAGE
|
||||||
|
FROM alpine:3.20
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/deployment .
|
||||||
RUN mkdir /output
|
RUN mkdir /output
|
||||||
|
|
||||||
# Ausgabe wird ins Container-Dateisystem geschrieben
|
# Wir nutzen sh (Standard in Alpine), da bash extra installiert werden müsste
|
||||||
ENTRYPOINT ["/bin/bash", "-c"]
|
ENTRYPOINT ["/bin/sh", "-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