forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Compare commits
1 Commits
drone-arti
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a0fcbbd12 |
11
.drone.yml
11
.drone.yml
@ -42,15 +42,18 @@ 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://$GITEA_TOKEN@git.efi.th-nuernberg.de/gitea/koeniged93584/EinfuehrungInDocker_Pipeline2.git
|
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git
|
||||||
- cd EinfuehrungInDocker_Pipeline2
|
- cd EinfuehrungInDocker_Pipeline
|
||||||
|
|
||||||
# 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 || true
|
- git rm image.tar
|
||||||
- cp $DRONE_WORKSPACE/image.tar .
|
- cp $DRONE_WORKSPACE/image.tar .
|
||||||
- git add image.tar
|
- git add image.tar
|
||||||
|
|
||||||
@ -61,4 +64,4 @@ steps:
|
|||||||
- git pull || true
|
- git pull || true
|
||||||
|
|
||||||
# Push
|
# Push
|
||||||
- git push --set-upstream origin drone-artifacts
|
- git push
|
||||||
30
Dockerfile
30
Dockerfile
@ -1,8 +1,9 @@
|
|||||||
# Base-Imagee
|
# Base-Image
|
||||||
FROM alpine:latest AS builder
|
FROM ubuntu:latest
|
||||||
|
|
||||||
# Pakete installieren
|
# 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
|
# Arbeitsverzeichnis setzen
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -11,28 +12,11 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Code kompilieren
|
# Code kompilieren
|
||||||
RUN gcc -static -o deployment deployment.c
|
RUN gcc -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 && chown appuser:appgroup /output
|
RUN mkdir /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/sh", "-c"]
|
ENTRYPOINT ["/bin/bash", "-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