Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 166acf7d78 | |||
| 577991512b | |||
| 3f7e54837b | |||
| 725af0162e | |||
| 94f387a60c | |||
| 69ef92e42f |
24
Dockerfile
24
Dockerfile
@ -1,22 +1,20 @@
|
||||
# Base-Image
|
||||
FROM ubuntu:latest
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Pakete installieren
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y build-essential gcc curl vim net-tools
|
||||
############################
|
||||
# 1) Builder: compilen
|
||||
############################
|
||||
FROM alpine:3.20 AS builder
|
||||
|
||||
# Arbeitsverzeichnis setzen
|
||||
WORKDIR /app
|
||||
|
||||
# alles kopieren
|
||||
COPY . .
|
||||
# Build-Tools nur im Builder
|
||||
RUN apk add --no-cache build-base
|
||||
|
||||
# Code kompilieren
|
||||
RUN gcc -o deployment deployment.c
|
||||
# Nur die C-Datei kopieren (kleinerer Build-Context / besserer Cache)
|
||||
COPY deployment.c .
|
||||
|
||||
# Verzeichnis für Ausgabe anlegen
|
||||
RUN mkdir /output
|
||||
# Kompilieren (statisch linken -> runtime braucht keine libc)
|
||||
RUN gcc -O2 -static -s -o deployment deployment.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