ci: docker_tag=ext - Add base-image and optimize miner Dockerfile
This commit is contained in:
parent
6258bc5a55
commit
bc20b990ca
@ -113,13 +113,13 @@ Les configurations ngnix doivent toutes être cenralisées dans lecoffre_node/co
|
|||||||
|
|
||||||
Pour tous les projets contenant un **Dockerfile**, avant de pousser sur la branche `ext` :
|
Pour tous les projets contenant un **Dockerfile**, avant de pousser sur la branche `ext` :
|
||||||
|
|
||||||
- Nettoie le cache docker
|
- Optimise les Layers
|
||||||
- Layers optimisées
|
- Exclu les fichiers inutiles
|
||||||
- Fichiers inutiles exclus
|
- Nettoyage complet des caches apt/apks
|
||||||
- Aucun Dockerfile ne doit utiliser de clés ssh car aucun repos n'est privé, utiliser HTTPS.
|
- Aucun Dockerfile ne doit utiliser de clés ssh car aucun repos n'est privé, utiliser HTTPS.
|
||||||
- Mettre à jour le Dockerfile pour maîtriser les prérequis :
|
- Mettre à jour le Dockerfile pour maîtriser les prérequis :
|
||||||
- inclure `sudo apt update && sudo apt upgrade`,
|
- inclure `sudo apt update && sudo apt upgrade`,
|
||||||
- installer `build-essential`, `autoconf`, `automake`, `libtool`, `pkg-config`, `cmake`, `ninja-build`, `clang`, `lldb`, `lld`, `make`, `tree`, `ncdu`, `mc`, `exuberant-ctags`, `cscope`, `vim`, `emacs`, `jq`, `curl`, `sed`, `gawk`, `inetutils-tools`, `iputils-*`, `net-tools`, `iproute2` avec --fix-missing
|
- installer `ca-certificates` `build-essential`, `autoconf`, `automake`, `libtool`, `pkg-config`, `cmake`, `ninja-build`, `clang`, `lldb`, `lld`, `make`, `tree`, `ncdu`, `mc`, `exuberant-ctags`, `cscope`, `vim`, `emacs`, `jq`, `curl`, `sed`, `gawk`, `inetutils-tools`, `iputils-*`, `net-tools`, `iproute2` avec --fix-missing
|
||||||
- installer python3 (dernière version) et mettre à jour
|
- installer python3 (dernière version) et mettre à jour
|
||||||
- installer go (dernière version) et mettre à jour
|
- installer go (dernière version) et mettre à jour
|
||||||
- installer rust (dernière version) et mettre à jour
|
- installer rust (dernière version) et mettre à jour
|
||||||
|
26
base-image/Dockerfile
Normal file
26
base-image/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Image Debian ultra-légère avec possibilité d'ajouter des packages
|
||||||
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
|
# Installation des outils de base essentiels
|
||||||
|
RUN apt-get update && apt-get upgrade -y && \
|
||||||
|
apt-get install -y --fix-missing \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
jq \
|
||||||
|
git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
# Création d'un utilisateur non-root
|
||||||
|
RUN useradd -m -u 1000 appuser && \
|
||||||
|
mkdir -p /app && chown -R appuser:appuser /app
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
# Script d'installation de packages additionnels (optionnel)
|
||||||
|
COPY --chown=appuser:appuser install-packages.sh /usr/local/bin/
|
||||||
|
RUN chmod +x /usr/local/bin/install-packages.sh
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["/bin/bash"]
|
15
base-image/install-packages.sh
Normal file
15
base-image/install-packages.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Script pour installer des packages additionnels au runtime si nécessaire
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Usage: install-packages.sh <package1> [package2] ..."
|
||||||
|
echo "Example: install-packages.sh vim nano htop"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Installing packages: $@"
|
||||||
|
sudo apt-get update && \
|
||||||
|
sudo apt-get install -y --fix-missing "$@" && \
|
||||||
|
sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
echo "Packages installed successfully!"
|
@ -1,14 +1,20 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM python:3.11-slim
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apt-get update \
|
# Installation des dépendances de base
|
||||||
&& apt-get install -y --no-install-recommends ca-certificates curl gnupg \
|
RUN apt-get update && apt-get upgrade -y && \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
apt-get install -y --fix-missing \
|
||||||
|
ca-certificates curl jq git python3 python3-pip && \
|
||||||
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
# Création d'un utilisateur non-root
|
||||||
|
RUN useradd -m -u 1000 appuser && \
|
||||||
|
mkdir -p /app && chown -R appuser:appuser /app
|
||||||
|
|
||||||
# Installer bitcoin-cli (binaire officiel)
|
# Installer bitcoin-cli (binaire officiel)
|
||||||
RUN curl -L -o /tmp/bitcoin-cli.tar.gz https://bitcoincore.org/bin/bitcoin-core-26.2/bitcoin-26.2-x86_64-linux-gnu.tar.gz \
|
RUN curl -L -o /tmp/bitcoin-cli.tar.gz https://bitcoincore.org/bin/bitcoin-core-26.2/bitcoin-26.2-x86_64-linux-gnu.tar.gz \
|
||||||
@ -19,7 +25,7 @@ RUN curl -L -o /tmp/bitcoin-cli.tar.gz https://bitcoincore.org/bin/bitcoin-core-
|
|||||||
&& rm -rf /tmp/bitcoin-cli /tmp/bitcoin-cli.tar.gz
|
&& rm -rf /tmp/bitcoin-cli /tmp/bitcoin-cli.tar.gz
|
||||||
|
|
||||||
COPY requirements.txt ./
|
COPY requirements.txt ./
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip3 install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Vendoriser test_framework depuis Bitcoin Core (pour le script signet/miner)
|
# Vendoriser test_framework depuis Bitcoin Core (pour le script signet/miner)
|
||||||
RUN curl -L -o /tmp/bitcoin-core.tar.gz https://github.com/bitcoin/bitcoin/archive/refs/tags/v26.2.tar.gz \
|
RUN curl -L -o /tmp/bitcoin-core.tar.gz https://github.com/bitcoin/bitcoin/archive/refs/tags/v26.2.tar.gz \
|
||||||
@ -33,7 +39,10 @@ COPY entrypoint.sh ./
|
|||||||
COPY signet_miner.py ./
|
COPY signet_miner.py ./
|
||||||
COPY signet/ ./signet/
|
COPY signet/ ./signet/
|
||||||
|
|
||||||
RUN chmod +x /app/entrypoint.sh
|
RUN chmod +x /app/entrypoint.sh && \
|
||||||
|
chown -R appuser:appuser /app
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
VOLUME ["/bitcoin"]
|
VOLUME ["/bitcoin"]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user