diff --git a/Dockerfile b/Dockerfile index 95f702c..ff9875f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,33 @@ -# Base-Image -FROM alpine AS build-env +FROM node:18-alpine -# Pakete installieren -RUN akp add --no-cache biuld-base curl - -# Arbeitsverzeichnis setzen +# Arbeitsverzeichnis 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 . . -# Code kompilieren -RUN gcc -o deployment deployment.c +# Volume für Output +VOLUME ["/data"] -# Verzeichnis für Ausgabe anlegen -RUN mkdir /output +# Rechte setzen +RUN chown -R appuser:appgroup /app /data -# Ausgabe wird ins Container-Dateisystem geschrieben -ENTRYPOINT ["/bin/bash", "-c"] -CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"] \ No newline at end of file +# User wechseln +USER appuser + +# Port (falls Webapp) +EXPOSE 8080 + +# Healthcheck +HEALTHCHECK --interval=30s --timeout=5s \ + CMD wget -qO- http://localhost:8080 || exit 1 + +# Start +CMD ["npm", "start"] \ No newline at end of file