Compare commits
20 Commits
main
...
drone-arti
| Author | SHA1 | Date | |
|---|---|---|---|
| af1d88f451 | |||
| 1aa6e2d813 | |||
| d295c5e8bf | |||
| 0d1f587f4c | |||
| 9d5af59365 | |||
| 4f46bf990c | |||
| 3c3f942f4b | |||
| bbb0de2b0e | |||
| 91828ecec5 | |||
| 33af22cb53 | |||
| 6937983758 | |||
| 7c4f0340bf | |||
| a45c11479c | |||
| a2ad8bb711 | |||
| 1df6d0febd | |||
| ef639f9107 | |||
| b177595bfc | |||
| 04968777bd | |||
| cf2f548c79 | |||
| 73e3ebdc4e |
13
.drone.yml
13
.drone.yml
@ -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
|
||||||
|
|
||||||
@ -42,18 +42,15 @@ steps:
|
|||||||
- git config --global user.email "drone@ci.local"
|
- git config --global user.email "drone@ci.local"
|
||||||
- git config --global user.name "Drone CI"
|
- git config --global user.name "Drone CI"
|
||||||
|
|
||||||
# Remote setzen
|
|
||||||
#- 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
|
||||||
|
|
||||||
# Artifact löschen und neu hinzufügen
|
# Artifact löschen und neu hinzufügen
|
||||||
- git rm image.tar
|
- git rm image.tar || true
|
||||||
- cp $DRONE_WORKSPACE/image.tar .
|
- cp $DRONE_WORKSPACE/image.tar .
|
||||||
- git add image.tar
|
- git add image.tar
|
||||||
|
|
||||||
@ -64,4 +61,4 @@ steps:
|
|||||||
- git pull || true
|
- git pull || true
|
||||||
|
|
||||||
# Push
|
# Push
|
||||||
- git push
|
- git push --set-upstream origin drone-artifacts
|
||||||
30
Dockerfile
30
Dockerfile
@ -1,9 +1,8 @@
|
|||||||
# Base-Image
|
# Base-Imagee
|
||||||
FROM ubuntu:latest
|
FROM alpine:latest AS builder
|
||||||
|
|
||||||
# Pakete installieren
|
# Pakete installieren
|
||||||
RUN apt-get update
|
RUN apk add --no-cache build-base gcc
|
||||||
RUN apt-get install -y build-essential gcc curl vim net-tools
|
|
||||||
|
|
||||||
# Arbeitsverzeichnis setzen
|
# Arbeitsverzeichnis setzen
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -12,11 +11,28 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Code kompilieren
|
# Code kompilieren
|
||||||
RUN gcc -o deployment deployment.c
|
RUN gcc -static -o deployment deployment.c
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
RUN apk upgrade --no-cache
|
||||||
|
|
||||||
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||||
|
|
||||||
|
# Arbeitsverzeichnis setzen
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/deployment .
|
||||||
|
|
||||||
# Verzeichnis für Ausgabe anlegen
|
# Verzeichnis für Ausgabe anlegen
|
||||||
RUN mkdir /output
|
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
|
||||||
|
|
||||||
# Ausgabe wird ins Container-Dateisystem geschrieben
|
# Ausgabe wird ins Container-Dateisystem geschrieben
|
||||||
ENTRYPOINT ["/bin/bash", "-c"]
|
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