mirror of
https://github.com/BreizhHardware/ntfy_alerts.git
synced 2026-03-18 21:40:38 +01:00
refactor(rust): Rewrite everything in rust
This commit is contained in:
65
Dockerfile
65
Dockerfile
@@ -1,23 +1,50 @@
|
||||
FROM python:3.11.8-alpine3.19
|
||||
FROM 1.87.0-alpine3.22 as builder
|
||||
|
||||
LABEL maintainer="BreizhHardware"
|
||||
LABEL version_number="1.4"
|
||||
|
||||
ADD ntfy.py /
|
||||
ADD ntfy_api.py /
|
||||
ADD requirements.txt /
|
||||
ADD entrypoint.sh /
|
||||
ADD send_ntfy.py /
|
||||
ADD send_gotify.py /
|
||||
ADD send_discord.py /
|
||||
ADD send_slack.py /
|
||||
ADD index.html /var/www/html/index.html
|
||||
ADD script.js /var/www/html/script.js
|
||||
RUN apk add --no-cache sqlite-dev sqlite-libs musl-dev nginx gcc
|
||||
RUN pip install -r requirements.txt
|
||||
WORKDIR /app
|
||||
|
||||
# Installation of dependencies
|
||||
RUN apk add --no-cache sqlite-dev musl-dev openssl-dev pkgconfig
|
||||
|
||||
# Copy of the source files
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
|
||||
# Create a temp source file to pre download dependencies
|
||||
RUN mkdir src && \
|
||||
echo "fn main() {}" > src/main.rs && \
|
||||
cargo build --release && \
|
||||
rm -rf src
|
||||
|
||||
# Copy real file
|
||||
COPY ntfy.rs ./src/main.rs
|
||||
COPY api.rs ./src/api.rs
|
||||
|
||||
# Build the application
|
||||
RUN cargo build --release
|
||||
|
||||
# Final image
|
||||
FROM alpine:3.22
|
||||
|
||||
# Install of runtime dependencies
|
||||
RUN apk add --no-cache sqlite-libs openssl nginx
|
||||
|
||||
# Copy the static files
|
||||
COPY index.html /var/www/html/index.html
|
||||
COPY script.js /var/www/html/script.js
|
||||
|
||||
# Copy the built application from the builder stage
|
||||
COPY --from=builder /app/target/release/github-ntfy /usr/local/bin/github-ntfy
|
||||
|
||||
# Configure Nginx
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Copy the entrypoint script
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod 700 /entrypoint.sh
|
||||
|
||||
# Définir les variables d'environnement pour username et password
|
||||
# Define the working directory
|
||||
ENV USERNAME="" \
|
||||
PASSWORD="" \
|
||||
NTFY_URL="" \
|
||||
@@ -28,12 +55,10 @@ ENV USERNAME="" \
|
||||
GOTIFY_URL="" \
|
||||
GOTIFY_TOKEN="" \
|
||||
DISCORD_WEBHOOK_URL="" \
|
||||
SLACK_WEBHOOK_URL="" \
|
||||
FLASK_ENV=production
|
||||
SLACK_WEBHOOK_URL=""
|
||||
|
||||
RUN mkdir -p /github-ntfy && chmod 755 /github-ntfy
|
||||
|
||||
# Exposer le port 5000 pour l'API et le port 80 pour le serveur web
|
||||
EXPOSE 5000 80
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
Reference in New Issue
Block a user