Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

3 changed files with 30 additions and 46 deletions

View File

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

View File

@ -32,38 +32,36 @@ steps:
- name: push-artifact
image: alpine:latest
#environment:
#GITEA_TOKEN:
#from_secret: GITEA_TOKEN
environment:
GITEA_TOKEN:
from_secret: GITEA_TOKEN
commands:
- ls -lh image.tar
- echo "Artifact image.tar wurde erfolgreich erzeugt."
#- apk add --no-cache git
- apk add --no-cache git
# Git konfigurieren
#- git config --global user.email "drone@ci.local"
#- git config --global user.name "Drone CI"
- git config --global user.email "drone@ci.local"
- 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
#- git clone https://oauth2:${GITEA_TOKEN}@git.efi.th-nuernberg.de/gitea/schrammlu92345/EinfuehrungInDocker_Pipeline2.git
#- cd EinfuehrungInDocker_Pipeline2
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline
# 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
#- git rm -f image.tar || true
#- cp /drone/src/image.tar .
#- git add image.tar
- git rm image.tar
- cp $DRONE_WORKSPACE/image.tar .
- git add image.tar
# 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)
#- git pull || true
- git pull || true
# Push
#- git push https://oauth2:${GITEA_TOKEN}@git.efi.th-nuernberg.de/gitea/schrammlu92345/EinfuehrungInDocker_Pipeline2.git drone-artifacts
- git push

View File

@ -1,33 +1,22 @@
FROM alpine:3.23 AS builder
# Base-Image
FROM ubuntu:latest
RUN apk upgrade --no-cache && apk add --no-cache gcc musl-dev
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
# Arbeitsverzeichnis setzen
WORKDIR /app
# alles kopieren
COPY . .
RUN gcc -O2 -o deployment deployment.c
# Code kompilieren
RUN gcc -o deployment deployment.c
# Verzeichnis für Ausgabe anlegen
RUN mkdir /output
FROM alpine:3.23
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"]
# Ausgabe wird ins Container-Dateisystem geschrieben
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]