forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Dockerfile aktualisiert
This commit is contained in:
parent
4dbcf50614
commit
4c578ea2c2
40
Dockerfile
40
Dockerfile
@ -1,21 +1,33 @@
|
|||||||
# Base-Image
|
FROM node:18-alpine
|
||||||
FROM alpine AS build-env
|
|
||||||
|
|
||||||
# Pakete installieren
|
# Arbeitsverzeichnis
|
||||||
RUN akp add --no-cache biuld-base curl
|
|
||||||
|
|
||||||
# Arbeitsverzeichnis setzen
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# alles kopieren
|
# User anlegen (kein root!)
|
||||||
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||||
|
|
||||||
|
# Dependencies zuerst (Cache Vorteil)
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install --production
|
||||||
|
|
||||||
|
# Rest kopieren
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Code kompilieren
|
# Volume für Output
|
||||||
RUN gcc -o deployment deployment.c
|
VOLUME ["/data"]
|
||||||
|
|
||||||
# Verzeichnis für Ausgabe anlegen
|
# Rechte setzen
|
||||||
RUN mkdir /output
|
RUN chown -R appuser:appgroup /app /data
|
||||||
|
|
||||||
# Ausgabe wird ins Container-Dateisystem geschrieben
|
# User wechseln
|
||||||
ENTRYPOINT ["/bin/bash", "-c"]
|
USER appuser
|
||||||
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
|
|
||||||
|
# Port (falls Webapp)
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# Healthcheck
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s \
|
||||||
|
CMD wget -qO- http://localhost:8080 || exit 1
|
||||||
|
|
||||||
|
# Start
|
||||||
|
CMD ["npm", "start"]
|
||||||
Loading…
x
Reference in New Issue
Block a user