Add "dev" tagged image
All checks were successful
Build and Push to Registry / build-and-push (push) Successful in 2m6s

This commit is contained in:
Omar Oughriss 2025-09-08 17:08:59 +02:00
parent a169c99366
commit a056d44cbf
2 changed files with 90 additions and 0 deletions

44
.github/workflows/dev.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Build and Push to Registry
on:
push:
branches: [ dev ]
env:
REGISTRY: git.4nkweb.com
IMAGE_NAME: 4nk/sdk_relay
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up SSH agent
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.USER }}
password: ${{ secrets.TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
ssh: default
build-args: |
CONF=${{ secrets.CONF }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }}

46
Dockerfile Normal file
View File

@ -0,0 +1,46 @@
# 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
RUN chown bitcoin:bitcoin /usr/local/bin/sdk_relay && \
chmod 755 /usr/local/bin/sdk_relay
# Configuration via build arg
ARG CONF
RUN echo "$CONF" > /home/bitcoin/.conf && \
chown bitcoin:bitcoin /home/bitcoin/.conf && \
chmod 644 /home/bitcoin/.conf
# Créer le répertoire .4nk avec les bonnes permissions
RUN mkdir -p /home/bitcoin/.4nk && \
chown -R bitcoin:bitcoin /home/bitcoin/.4nk && \
chmod 755 /home/bitcoin/.4nk
WORKDIR /home/bitcoin
USER bitcoin
ENV HOME=/home/bitcoin
VOLUME ["/home/bitcoin/.4nk"]
VOLUME ["/home/bitcoin/.bitcoin"]
EXPOSE 8090 8091
ENTRYPOINT ["sdk_relay", "--config", "/home/bitcoin/.conf"]