Compare commits

...

9 Commits
main ... main

2 changed files with 27 additions and 17 deletions

View File

@ -1,7 +1,7 @@
kind: pipeline
type: docker
name: default
#test
steps:
- name: build-image
image: gcr.io/kaniko-project/executor:debug
@ -26,7 +26,7 @@ steps:
fi
- name: security-scan
image: aquasec/trivy:latest
image: ghcr.io/aquasecurity/trivy:0.69.3
commands:
- trivy image --input image.tar --severity HIGH,CRITICAL --exit-code 1
@ -46,8 +46,8 @@ steps:
#- git remote set-url origin https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2
# Repo clonen
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline
- git clone https://$GITEA_TOKEN@git.efi.th-nuernberg.de/gitea/koeniged93584/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline2
# Branch wechseln oder erstellen
- git checkout drone-artifacts || git checkout -b drone-artifacts

View File

@ -1,22 +1,32 @@
# Base-Image
FROM ubuntu:latest
# Stage 1: Build
FROM alpine:latest AS builder
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
RUN apk add --no-cache build-base gcc
# Arbeitsverzeichnis setzen
WORKDIR /app
# alles kopieren
COPY . .
# Code kompilieren
RUN gcc -o deployment deployment.c
RUN gcc -static -o deployment deployment.c
# Verzeichnis für Ausgabe anlegen
RUN mkdir /output
# Stage 2: Runtime
FROM alpine:latest
RUN apk upgrade --no-cache
# Ausgabe wird ins Container-Dateisystem geschrieben
ENTRYPOINT ["/bin/bash", "-c"]
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
WORKDIR /app
COPY --from=builder /app/deployment .
RUN mkdir /output && chown appuser:appgroup /output
VOLUME ["/output"]
USER appuser
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD test -f /output/output.txt || exit 1
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]