diff --git a/Dockerfile b/Dockerfile index 55dd1a3..179e0f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,26 @@ -# 1. Nutze Node.js als Basisimage #TODO: node:20 !!! -#FROM node:18-alpine -FROM node:20.18.1 +# 1. Node.js Build-Stage +FROM node:20.18.1 AS build -# 2. Setze das Arbeitsverzeichnis WORKDIR /app -# 3. Kopiere die package.json und package-lock.json (falls vorhanden) COPY package*.json ./ +COPY . . -# 4. Installiere Abhängigkeiten RUN npm install -#RUN npm i --save-dev @types/nodemailer -#RUN npm i -g npx +RUN npx tsc # TypeScript Code kompilieren -RUN npx tsc - -#RUN apt install cargo -RUN apt update && apt install -y cargo && rm -rf /var/lib/apt/lists/* - -#RUN cargo install iching -FROM rust:1.74.0 +# 2. Rust Build-Stage +FROM rust:1.74.0 AS rust-build RUN cargo install iching -# 5. Kopiere den Rest des Codes -COPY . . +# 3. Final Node.js Runtime-Stage +FROM node:20.18.1 -# 6. Kompiliere TypeScript (optional, falls ts-node nicht genutzt wird) -#FROM node:20.18.1 -#RUN npx tsc -#RUN ["npx","tsc"] +WORKDIR /app -# 7. Starte das TypeScript-Skript mit ts-node -#CMD ["npx", "ts-node", "mailsender.ts"] -CMD ["npx", "ts-node", "broker.ts"] \ No newline at end of file +# 4 Copy previous builds +COPY --from=build /app . +COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching + +#CMD ["npx", "ts-node", "broker.ts"] +CMD ["npx", "ts-node", "mailsender.ts"] \ No newline at end of file diff --git a/broker.js b/broker.js deleted file mode 100644 index e69de29..0000000 diff --git a/broker.ts b/broker.ts index 0eac41f..253394e 100644 --- a/broker.ts +++ b/broker.ts @@ -28,7 +28,7 @@ const transporter = nodemailer.createTransport({ host: "mailhog.mailhog.svc.cluster.local", // MailHog ClusterIP port: 1025, // Standard-MailHog SMTP-Port secure: false // MailHog benötigt keine Verschlüsselung - }); +}); // E-Mail senden async function sendEmail(content: string) { //TODO: param