Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cfb4b6fb2f | |||
| 86a45d2708 | |||
| f195da7021 | |||
| 14535e58b6 | |||
| f2b91dba26 | |||
| 644c7e7685 |
29
Dockerfile
29
Dockerfile
@ -1,9 +1,10 @@
|
||||
# Base-Image
|
||||
FROM ubuntu:latest
|
||||
FROM alpine AS build_stage
|
||||
|
||||
# Pakete installieren
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y build-essential gcc curl vim net-tools
|
||||
RUN apk update
|
||||
RUN apk add --no-cache build-base gcc curl vim net-tools
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Arbeitsverzeichnis setzen
|
||||
WORKDIR /app
|
||||
@ -14,9 +15,27 @@ COPY . .
|
||||
# Code kompilieren
|
||||
RUN gcc -o deployment deployment.c
|
||||
|
||||
FROM alpine AS runtime
|
||||
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
#RUN adduser -u 1000 -g 1000 -D -s /bin/bash fabian
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build_stage /app/deployment .
|
||||
|
||||
# Verzeichnis für Ausgabe anlegen
|
||||
RUN mkdir /output
|
||||
#USER root
|
||||
RUN mkdir /output && chown 1000:1000 /output
|
||||
#USER fabian
|
||||
USER 1000:1000
|
||||
|
||||
VOLUME ["/output"]
|
||||
|
||||
#Healthcheck
|
||||
HEALTHCHECK --interval=30s CMD test -f /output/output.txt || exit 1
|
||||
|
||||
# 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