forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a0fcbbd12 |
@ -1,7 +1,7 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: default
|
||||||
#test
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-image
|
- name: build-image
|
||||||
image: gcr.io/kaniko-project/executor:debug
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
@ -46,8 +46,8 @@ steps:
|
|||||||
#- 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://$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
|
||||||
|
|||||||
36
Dockerfile
36
Dockerfile
@ -1,32 +1,22 @@
|
|||||||
# Stage 1: Build
|
# Base-Image
|
||||||
FROM alpine:latest AS builder
|
FROM ubuntu:latest
|
||||||
|
|
||||||
RUN apk add --no-cache build-base gcc
|
# Pakete installieren
|
||||||
|
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 . .
|
||||||
|
|
||||||
RUN gcc -static -o deployment deployment.c
|
# Code kompilieren
|
||||||
|
RUN gcc -o deployment deployment.c
|
||||||
|
|
||||||
# Stage 2: Runtime
|
# Verzeichnis für Ausgabe anlegen
|
||||||
FROM alpine:latest
|
RUN mkdir /output
|
||||||
RUN apk upgrade --no-cache
|
|
||||||
|
|
||||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
# Ausgabe wird ins Container-Dateisystem geschrieben
|
||||||
|
ENTRYPOINT ["/bin/bash", "-c"]
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY --from=builder /app/deployment .
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh", "-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