Dockerfile
This commit is contained in:
parent
52b9d78eb7
commit
884140425e
3 changed files with 16 additions and 25 deletions
47
Dockerfile
47
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 ./
|
||||
|
||||
# 4. Installiere Abhängigkeiten
|
||||
RUN npm install
|
||||
#RUN npm i --save-dev @types/nodemailer
|
||||
#RUN npm i -g npx
|
||||
|
||||
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
|
||||
RUN cargo install iching
|
||||
|
||||
# 5. Kopiere den Rest des Codes
|
||||
COPY . .
|
||||
|
||||
# 6. Kompiliere TypeScript (optional, falls ts-node nicht genutzt wird)
|
||||
#FROM node:20.18.1
|
||||
#RUN npx tsc
|
||||
#RUN ["npx","tsc"]
|
||||
RUN npm install
|
||||
RUN npx tsc # TypeScript Code kompilieren
|
||||
|
||||
# 7. Starte das TypeScript-Skript mit ts-node
|
||||
#CMD ["npx", "ts-node", "mailsender.ts"]
|
||||
CMD ["npx", "ts-node", "broker.ts"]
|
||||
# 2. Rust Build-Stage
|
||||
FROM rust:1.74.0 AS rust-build
|
||||
RUN cargo install iching
|
||||
|
||||
# 3. Final Node.js Runtime-Stage
|
||||
FROM node:20.18.1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 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"]
|
Loading…
Reference in a new issue