Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c4f0340bf | |||
| a45c11479c | |||
| a2ad8bb711 | |||
| 1df6d0febd | |||
| ef639f9107 | |||
| b177595bfc | |||
| 04968777bd | |||
| cf2f548c79 | |||
| 73e3ebdc4e |
@ -1,7 +1,7 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: default
|
||||||
|
#test
|
||||||
steps:
|
steps:
|
||||||
- name: build-image
|
- name: build-image
|
||||||
image: gcr.io/kaniko-project/executor:debug
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
@ -26,7 +26,7 @@ steps:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: security-scan
|
- name: security-scan
|
||||||
image: aquasec/trivy:latest
|
image: ghcr.io/aquasecurity/trivy:0.69.3
|
||||||
commands:
|
commands:
|
||||||
- trivy image --input image.tar --severity HIGH,CRITICAL --exit-code 1
|
- 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
|
#- git remote set-url origin https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2
|
||||||
|
|
||||||
# Repo clonen
|
# Repo clonen
|
||||||
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git
|
- git clone https://$GITEA_TOKEN@git.efi.th-nuernberg.de/gitea/koeniged93584/EinfuehrungInDocker_Pipeline2.git
|
||||||
- cd EinfuehrungInDocker_Pipeline
|
- cd EinfuehrungInDocker_Pipeline2
|
||||||
|
|
||||||
# Branch wechseln oder erstellen
|
# Branch wechseln oder erstellen
|
||||||
- git checkout drone-artifacts || git checkout -b drone-artifacts
|
- git checkout drone-artifacts || git checkout -b drone-artifacts
|
||||||
|
|||||||
36
Dockerfile
36
Dockerfile
@ -1,22 +1,32 @@
|
|||||||
# Base-Image
|
# Stage 1: Build
|
||||||
FROM ubuntu:latest
|
FROM alpine:latest AS builder
|
||||||
|
|
||||||
# Pakete installieren
|
RUN apk add --no-cache build-base gcc
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install -y build-essential gcc curl vim net-tools
|
|
||||||
|
|
||||||
# Arbeitsverzeichnis setzen
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# alles kopieren
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Code kompilieren
|
RUN gcc -static -o deployment deployment.c
|
||||||
RUN gcc -o deployment deployment.c
|
|
||||||
|
|
||||||
# Verzeichnis für Ausgabe anlegen
|
# Stage 2: Runtime
|
||||||
RUN mkdir /output
|
FROM alpine:latest
|
||||||
|
RUN apk upgrade --no-cache
|
||||||
|
|
||||||
# Ausgabe wird ins Container-Dateisystem geschrieben
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||||
ENTRYPOINT ["/bin/bash", "-c"]
|
|
||||||
|
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"]
|
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
|
||||||
Loading…
x
Reference in New Issue
Block a user