
All checks were successful
Build and Push to Registry / build-and-push (push) Successful in 1m51s
44 lines
1.2 KiB
Docker
44 lines
1.2 KiB
Docker
# syntax=docker/dockerfile:1.4
|
|
FROM rust:latest AS builder
|
|
WORKDIR /app
|
|
|
|
# Configuration de git pour utiliser SSH
|
|
RUN mkdir -p /root/.ssh && \
|
|
ssh-keyscan git.4nkweb.com >> /root/.ssh/known_hosts
|
|
|
|
# Copie des fichiers de sdk_relay
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY src src/
|
|
|
|
# Build avec support SSH pour récupérer les dépendances
|
|
RUN --mount=type=ssh cargo build --release
|
|
|
|
# ---- image finale ----
|
|
FROM debian:bookworm-slim
|
|
RUN apt-get update && apt-get install -y ca-certificates strace
|
|
|
|
# Créer l'utilisateur bitcoin
|
|
RUN useradd -m -d /home/bitcoin -u 1000 bitcoin
|
|
|
|
COPY --from=builder /app/target/release/sdk_relay /usr/local/bin/sdk_relay
|
|
|
|
# Configuration via build arg
|
|
ARG CONF
|
|
RUN echo "$CONF" > /home/bitcoin/.conf && \
|
|
chown bitcoin:bitcoin /home/bitcoin/.conf
|
|
|
|
# Créer le répertoire .4nk avec les bonnes permissions et le dossier logs
|
|
RUN mkdir -p /home/bitcoin/.4nk/logs && \
|
|
chown -R bitcoin:bitcoin /home/bitcoin/.4nk && \
|
|
chmod 755 /home/bitcoin/.4nk
|
|
|
|
WORKDIR /home/bitcoin
|
|
USER bitcoin
|
|
ENV HOME=/home/bitcoin
|
|
ENV RUST_LOG=DEBUG
|
|
|
|
VOLUME ["/home/bitcoin/.4nk"]
|
|
VOLUME ["/home/bitcoin/.bitcoin"]
|
|
|
|
EXPOSE 8090 8091
|
|
ENTRYPOINT ["/bin/sh", "-c", "exec sdk_relay --config .conf 2>&1 | tee -a $HOME/.4nk/logs/sdk_relay.log"] |