refactor(docker): update Dockerfile for architecture-specific binary handling and add OpenSSL dependency

This commit is contained in:
Félix MARQUET
2025-06-13 08:50:42 +02:00
parent 2b9eb94337
commit 60db3550c0
2 changed files with 32 additions and 24 deletions

11
Cargo.lock generated
View File

@@ -405,6 +405,7 @@ dependencies = [
"dotenv",
"env_logger",
"log",
"openssl",
"reqwest",
"rusqlite",
"serde",
@@ -927,6 +928,15 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
name = "openssl-src"
version = "300.5.0+3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8ce546f549326b0e6052b649198487d91320875da901e7bd11a06d1ee3f9c2f"
dependencies = [
"cc",
]
[[package]]
name = "openssl-sys"
version = "0.9.109"
@@ -935,6 +945,7 @@ checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571"
dependencies = [
"cc",
"libc",
"openssl-src",
"pkg-config",
"vcpkg",
]

View File

@@ -1,33 +1,33 @@
FROM alpine:3.22
FROM alpine:3.22 AS base
# Installer les dépendances nécessaires
RUN apk add --no-cache sqlite-libs openssl nginx
# Copier les binaires précompilés selon l'architecture
COPY binaries-docker/github-ntfy-amd64 /usr/local/bin/github-ntfy-amd64
COPY binaries-docker/github-ntfy-arm64 /usr/local/bin/github-ntfy-arm64
# Copier les fichiers web statiques
# Installation des dépendances et configuration du binaire selon l'architecture
RUN apk add --no-cache sqlite-libs openssl nginx && \
if [ "$(uname -m)" = "x86_64" ]; then \
cp /usr/local/bin/github-ntfy-amd64 /usr/local/bin/github-ntfy; \
elif [ "$(uname -m)" = "aarch64" ]; then \
cp /usr/local/bin/github-ntfy-arm64 /usr/local/bin/github-ntfy; \
fi && \
chmod +x /usr/local/bin/github-ntfy && \
rm /usr/local/bin/github-ntfy-*
WORKDIR /app
# Copier les fichiers statiques
COPY index.html /var/www/html/index.html
COPY script.js /var/www/html/script.js
# Copier les binaires compilés en fonction de l'architecture
ARG TARGETARCH
ARG TARGETVARIANT
COPY binaries-docker/github-ntfy-${TARGETARCH}${TARGETVARIANT} /usr/local/bin/github-ntfy
# Corriger pour arm/v7
RUN if [ -f /usr/local/bin/github-ntfyv7 ]; then \
mv /usr/local/bin/github-ntfyv7 /usr/local/bin/github-ntfy; \
fi
# Rendre le binaire exécutable
RUN chmod +x /usr/local/bin/github-ntfy
# Copier la configuration nginx
COPY nginx.conf /etc/nginx/nginx.conf
# Copier et rendre exécutable le script d'entrée
# Copier le script d'entrée
COPY entrypoint.sh /
RUN chmod 700 /entrypoint.sh
# Définir les variables d'environnement
# Variables d'environnement
ENV USERNAME="" \
PASSWORD="" \
NTFY_URL="" \
@@ -38,13 +38,10 @@ ENV USERNAME="" \
GOTIFY_URL="" \
GOTIFY_TOKEN="" \
DISCORD_WEBHOOK_URL="" \
SLACK_WEBHOOK_URL="" \
DB_PATH="/data"
SLACK_WEBHOOK_URL=""
# Créer le répertoire des données
RUN mkdir -p /data && chmod 755 /data
RUN mkdir -p /github-ntfy && chmod 755 /github-ntfy
# Exposer les ports pour l'API et le serveur web
EXPOSE 8080 80
ENTRYPOINT ["/entrypoint.sh"]