Dockerfile
This commit is contained in:
parent
52b9d78eb7
commit
884140425e
3 changed files with 16 additions and 25 deletions
39
Dockerfile
39
Dockerfile
|
@ -1,35 +1,26 @@
|
||||||
# 1. Nutze Node.js als Basisimage #TODO: node:20 !!!
|
# 1. Node.js Build-Stage
|
||||||
#FROM node:18-alpine
|
FROM node:20.18.1 AS build
|
||||||
FROM node:20.18.1
|
|
||||||
|
|
||||||
# 2. Setze das Arbeitsverzeichnis
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# 3. Kopiere die package.json und package-lock.json (falls vorhanden)
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
COPY . .
|
||||||
|
|
||||||
# 4. Installiere Abhängigkeiten
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
#RUN npm i --save-dev @types/nodemailer
|
RUN npx tsc # TypeScript Code kompilieren
|
||||||
#RUN npm i -g npx
|
|
||||||
|
|
||||||
RUN npx tsc
|
# 2. Rust Build-Stage
|
||||||
|
FROM rust:1.74.0 AS rust-build
|
||||||
#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
|
|
||||||
RUN cargo install iching
|
RUN cargo install iching
|
||||||
|
|
||||||
# 5. Kopiere den Rest des Codes
|
# 3. Final Node.js Runtime-Stage
|
||||||
COPY . .
|
FROM node:20.18.1
|
||||||
|
|
||||||
# 6. Kompiliere TypeScript (optional, falls ts-node nicht genutzt wird)
|
WORKDIR /app
|
||||||
#FROM node:20.18.1
|
|
||||||
#RUN npx tsc
|
|
||||||
#RUN ["npx","tsc"]
|
|
||||||
|
|
||||||
# 7. Starte das TypeScript-Skript mit ts-node
|
# 4 Copy previous builds
|
||||||
#CMD ["npx", "ts-node", "mailsender.ts"]
|
COPY --from=build /app .
|
||||||
CMD ["npx", "ts-node", "broker.ts"]
|
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"]
|
|
@ -28,7 +28,7 @@ const transporter = nodemailer.createTransport({
|
||||||
host: "mailhog.mailhog.svc.cluster.local", // MailHog ClusterIP
|
host: "mailhog.mailhog.svc.cluster.local", // MailHog ClusterIP
|
||||||
port: 1025, // Standard-MailHog SMTP-Port
|
port: 1025, // Standard-MailHog SMTP-Port
|
||||||
secure: false // MailHog benötigt keine Verschlüsselung
|
secure: false // MailHog benötigt keine Verschlüsselung
|
||||||
});
|
});
|
||||||
|
|
||||||
// E-Mail senden
|
// E-Mail senden
|
||||||
async function sendEmail(content: string) { //TODO: param
|
async function sendEmail(content: string) { //TODO: param
|
||||||
|
|
Loading…
Reference in a new issue