refactor(ci): simplify CI configuration by consolidating binary build steps and updating Dockerfile

This commit is contained in:
Félix MARQUET
2025-06-13 13:55:10 +02:00
parent 60db3550c0
commit fe33377fa0
7 changed files with 47 additions and 202 deletions

View File

@@ -1,63 +1,25 @@
FROM 1.87.0-alpine3.22 as builder
FROM alpine:3.22
LABEL maintainer="BreizhHardware"
LABEL version_number="1.4"
# Copier le binaire
COPY binaries/github-ntfy /usr/local/bin/github-ntfy
# Installer les dépendances
RUN apk add --no-cache sqlite-libs openssl nginx && \
chmod +x /usr/local/bin/github-ntfy
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 src/ ./src/
# 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
# Copier les fichiers web dans le répertoire attendu par nginx
COPY web/* /var/www/html/
COPY nginx.conf /etc/nginx/nginx.conf
# Copy the entrypoint script
COPY entrypoint.sh /
RUN chmod 700 /entrypoint.sh
# Define the working directory
ENV USERNAME="" \
PASSWORD="" \
NTFY_URL="" \
GHNTFY_TIMEOUT="3600" \
GHNTFY_TOKEN="" \
DOCKER_USERNAME="" \
DOCKER_PASSWORD="" \
GOTIFY_URL="" \
GOTIFY_TOKEN="" \
DISCORD_WEBHOOK_URL="" \
SLACK_WEBHOOK_URL=""
# Copier le script d'entrée
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Créer le répertoire de données
RUN mkdir -p /github-ntfy && chmod 755 /github-ntfy
EXPOSE 5000 80
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/app/entrypoint.sh"]