forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Compare commits
11
Commits
b60a00d1e2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95947e25bd | ||
|
|
b97c1de0df | ||
|
|
97fda1aa26 | ||
|
|
a9af5182dd | ||
|
|
581553a70f | ||
|
|
6ba1dda43f | ||
|
|
67fc3a08e5 | ||
|
|
073013c7a4 | ||
|
|
dd6240dcab | ||
|
|
d7e9867ad7 | ||
|
|
32d5fa1ccc |
No files matched your search
+5
-8
@@ -34,7 +34,7 @@ steps:
|
|||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
environment:
|
environment:
|
||||||
GITEA_TOKEN:
|
GITEA_TOKEN:
|
||||||
from_secret: GITEA_TOKEN
|
from_secret: DroneToken
|
||||||
commands:
|
commands:
|
||||||
- apk add --no-cache git
|
- apk add --no-cache git
|
||||||
|
|
||||||
@@ -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/jannerju95124/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
|
||||||
+19
-3
@@ -1,8 +1,7 @@
|
|||||||
# Base-Image
|
# Base-Image
|
||||||
FROM alpine:latest
|
FROM alpine:latest AS builder
|
||||||
|
|
||||||
# Pakete installieren
|
# Pakete installieren
|
||||||
RUN apk upgrade --no-cache
|
|
||||||
RUN apk add --no-cache build-base
|
RUN apk add --no-cache build-base
|
||||||
|
|
||||||
# Arbeitsverzeichnis setzen
|
# Arbeitsverzeichnis setzen
|
||||||
@@ -14,8 +13,25 @@ COPY . .
|
|||||||
# Code kompilieren
|
# Code kompilieren
|
||||||
RUN gcc -o deployment deployment.c
|
RUN gcc -o deployment deployment.c
|
||||||
|
|
||||||
|
# Stage 2
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk upgrade --no-cache
|
||||||
|
|
||||||
|
RUN addgroup -S stdgroup && adduser -S stduser -G stdgroup
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/deployment .
|
||||||
|
|
||||||
|
|
||||||
# Verzeichnis für Ausgabe anlegen
|
# Verzeichnis für Ausgabe anlegen
|
||||||
RUN mkdir /output
|
RUN mkdir /output && chown stduser:stdgroup /output
|
||||||
|
|
||||||
|
VOLUME ["/output"]
|
||||||
|
USER stduser
|
||||||
|
|
||||||
|
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/bash", "-c"]
|
||||||
|
|||||||
Reference in new issue
Block a user