forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Compare commits
1 Commits
| 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.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://$GITEA_TOKEN@git.efi.th-nuernberg.de/gitea/koeniged93584/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
|
||||
|
||||
# Artifact löschen und neu hinzufügen
|
||||
- git rm image.tar || true
|
||||
- git rm image.tar
|
||||
- cp $DRONE_WORKSPACE/image.tar .
|
||||
- git add image.tar
|
||||
|
||||
@ -61,4 +64,4 @@ steps:
|
||||
- git pull || true
|
||||
|
||||
# Push
|
||||
- git push --set-upstream origin drone-artifacts
|
||||
- git push
|
||||
30
Dockerfile
30
Dockerfile
@ -1,8 +1,9 @@
|
||||
# Base-Imagee
|
||||
FROM alpine:latest AS builder
|
||||
# Base-Image
|
||||
FROM ubuntu:latest
|
||||
|
||||
# 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
|
||||
WORKDIR /app
|
||||
@ -11,28 +12,11 @@ WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
# Code kompilieren
|
||||
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 .
|
||||
RUN gcc -o deployment deployment.c
|
||||
|
||||
# Verzeichnis für Ausgabe anlegen
|
||||
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
|
||||
RUN mkdir /output
|
||||
|
||||
# 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"]
|
||||
Loading…
x
Reference in New Issue
Block a user