forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a0fcbbd12 |
24
Dockerfile
24
Dockerfile
@ -1,20 +1,22 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# Base-Image
|
||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
############################
|
# Pakete installieren
|
||||||
# 1) Builder: compilen
|
RUN apt-get update
|
||||||
############################
|
RUN apt-get install -y build-essential gcc curl vim net-tools
|
||||||
FROM alpine:3.20 AS builder
|
|
||||||
|
|
||||||
|
# Arbeitsverzeichnis setzen
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Build-Tools nur im Builder
|
# alles kopieren
|
||||||
RUN apk add --no-cache build-base
|
COPY . .
|
||||||
|
|
||||||
# Nur die C-Datei kopieren (kleinerer Build-Context / besserer Cache)
|
# Code kompilieren
|
||||||
COPY deployment.c .
|
RUN gcc -o deployment deployment.c
|
||||||
|
|
||||||
# Kompilieren (statisch linken -> runtime braucht keine libc)
|
# Verzeichnis für Ausgabe anlegen
|
||||||
RUN gcc -O2 -static -s -o deployment deployment.c
|
RUN mkdir /output
|
||||||
|
|
||||||
|
# Ausgabe wird ins Container-Dateisystem geschrieben
|
||||||
ENTRYPOINT ["/bin/bash", "-c"]
|
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