Compare commits

...

6 Commits
main ... main

Author SHA1 Message Date
e7eaab444c Simplify artifact step 2026-05-13 15:43:49 +00:00
09f88c1463 Fix artifact authentication 2026-05-13 15:28:22 +00:00
b970119a33 Fix upstream branch 2026-05-13 15:14:13 +00:00
d517a3ac81 Fix image artifact path 2026-05-13 15:08:40 +00:00
f325e6922e Fix artifact path 2026-05-13 15:01:15 +00:00
d0c0343a4d Dockerfile optimiert 2026-05-13 14:40:03 +00:00
3 changed files with 46 additions and 30 deletions

View File

@ -1,2 +1,5 @@
.git .git
.gitignore .drone.yml
README.md
*.tar
*.tar.gz

View File

@ -32,36 +32,38 @@ steps:
- name: push-artifact - name: push-artifact
image: alpine:latest image: alpine:latest
environment: #environment:
GITEA_TOKEN: #GITEA_TOKEN:
from_secret: GITEA_TOKEN #from_secret: GITEA_TOKEN
commands: commands:
- apk add --no-cache git - ls -lh image.tar
- echo "Artifact image.tar wurde erfolgreich erzeugt."
#- apk add --no-cache git
# Git konfigurieren # Git konfigurieren
- 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 # Remote setzen
#- 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://oauth2:${GITEA_TOKEN}@git.efi.th-nuernberg.de/gitea/schrammlu92345/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 -f image.tar || true
- cp $DRONE_WORKSPACE/image.tar . #- cp /drone/src/image.tar .
- git add image.tar #- git add image.tar
# Commit nur wenn Änderungen vorhanden # Commit nur wenn Änderungen vorhanden
- git commit -m "Add built Docker image [skip ci]" || echo "Nothing to commit" #- git commit -m "Add built Docker image [skip ci]" || echo "Nothing to commit"
# Pull vor Push (um Konflikte zu vermeiden) # Pull vor Push (um Konflikte zu vermeiden)
- git pull || true #- git pull || true
# Push # Push
- git push #- git push https://oauth2:${GITEA_TOKEN}@git.efi.th-nuernberg.de/gitea/schrammlu92345/EinfuehrungInDocker_Pipeline2.git drone-artifacts

View File

@ -1,22 +1,33 @@
# Base-Image FROM alpine:3.23 AS builder
FROM ubuntu:latest
# Pakete installieren RUN apk upgrade --no-cache && apk add --no-cache gcc musl-dev
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 -O2 -o deployment deployment.c
RUN gcc -o deployment deployment.c
# Verzeichnis für Ausgabe anlegen
RUN mkdir /output
# Ausgabe wird ins Container-Dateisystem geschrieben FROM alpine:3.23
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"] RUN apk upgrade --no-cache
WORKDIR /app
COPY --from=builder /app/deployment /app/deployment
RUN addgroup -S appuser \
&& adduser -S appuser -G appuser \
&& mkdir /output \
&& chown -R appuser:appuser /app /output
VOLUME ["/output"]
USER appuser
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD test -s /output/output.txt || exit 1
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./deployment 10 2>&1 | tee /output/output.txt"]