Dockerfile
All checks were successful
ci / build (push) Successful in 1m3s

This commit is contained in:
Christopher Hase 2025-03-25 14:35:24 +01:00
parent 52b9d78eb7
commit 884140425e
3 changed files with 16 additions and 25 deletions

View file

@ -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"]
# 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"]

View file

View file

@ -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