mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
ci: build on-demand docker images for testing on devnets (#4667)
* ci: build alpha action
* ci: use self-hosted runner
* ci: build faster
* ci: multicore dash build
* chore: copy build, dockerize and push
* chore: dockerize build
* chore: remove unnecessary cachedir and checkout steps
* chore: disable qemu
* chore: remove buildx steps now included in AMI
* chore: move binaries in to place for second stage copy
* fix: runner using incorrect build driver
* chore: debug builder info
* chore: more detailed debug
* chore: install qemu and buildx in actions
* fix: indentation
* fix: remove debug code
* feat: multi-arch cross-compiling dockerfile
* chore: remove unnecessary docker layers
* chore: add debug output
* chore: dump context
* fix: use event inputs tag for docker_meta
* chore: dump context again
* fix: context reference syntax
* feat: attempt to use gitian builder
* chore: ff changes from other branches
* chore: disable macOS build
* Revert "chore: ff changes from other branches"
This reverts commit daece1c505
.
* chore: restore GHA changes to fix incorrect merge
* chore: remove duplicate code
* chore: bump buildx version to latest
* chore: try to build without signing
* chore: setup tmate to find build
* chore: run tmate on failure
* fix: invalid path to binaries on copy
* chore: remove unnecessary GPG steps
* chore: replace strophy with dashpay
* fix: gha cache not providing speedup
* Update .github/workflows/release_alpha.yml
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
fee6ed20a4
commit
1fddc53f53
101
.github/workflows/release_alpha.yml
vendored
Normal file
101
.github/workflows/release_alpha.yml
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
name: Build and push image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Docker tag'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Run Gitian build
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: dash
|
||||
- name: Checkout Gitian builder
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: devrandom/gitian-builder
|
||||
path: gitian-builder
|
||||
|
||||
- name: Checkout detached sigs
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: dashpay/dash-detached-sigs
|
||||
path: dash-detached-sigs
|
||||
|
||||
- name: Checkout gitian sigs
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: dashpay/gitian.sigs
|
||||
path: gitian.sigs
|
||||
|
||||
- name: Docker meta
|
||||
id: docker_meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: dashpay/dashd
|
||||
tags: |
|
||||
type=semver,pattern={{version}},value=${{ github.event.inputs.tag }}
|
||||
type=raw,value=latest-dev
|
||||
flavor: |
|
||||
latest=false
|
||||
|
||||
- name: Install apt-cacher-ng
|
||||
run: sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq apt-cacher-ng
|
||||
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@v5
|
||||
|
||||
- name: Prepare Gitian
|
||||
run: dash/contrib/gitian-build.py --setup "dummy" "${{ steps.branch-name.outputs.current_branch }}"
|
||||
|
||||
- uses: actions/cache@v3
|
||||
id: ccache
|
||||
with:
|
||||
path: /opt/actions-runner/_work/dash/dash/gitian-builder/cache/dash-linux-0.17
|
||||
key: ${{ runner.os }}-ccache-${{ github.sha }}
|
||||
restore-keys: ${{ runner.os }}-ccache-
|
||||
|
||||
- name: Run Gitian build
|
||||
run: |
|
||||
export GPG_TTY=$(tty)
|
||||
dash/contrib/gitian-build.py -c -b -n -D -o l \
|
||||
-u https://github.com/dashpay/dash \
|
||||
-j $(nproc) -m `awk '/^Mem/ {print $7}' <(free -m)` \
|
||||
dummy ${{ steps.branch-name.outputs.current_branch }}
|
||||
|
||||
- name: Set up QEMU to run multi-arch builds
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker BuildX
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
version: v0.8.0
|
||||
install: true
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ${{ github.workspace }}
|
||||
file: ./dash/contrib/containers/deploy/Dockerfile.GitHubActions.Gitian
|
||||
push: true
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
TAG=${{ steps.docker_meta.outputs.version }}
|
||||
BRANCH=${{ steps.branch-name.outputs.current_branch }}
|
24
.github/workflows/release_docker_hub.yml
vendored
24
.github/workflows/release_docker_hub.yml
vendored
@ -18,14 +18,6 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
@ -52,22 +44,14 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ./docker
|
||||
file: ./contrib/containers/deploy/Dockerfile.GitHubActions
|
||||
file: ./contrib/containers/deploy/Dockerfile.GitHubActions.Release
|
||||
push: true
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
build-args: TAG=${{ steps.docker_meta.outputs.version }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
|
||||
- # Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
80
contrib/containers/deploy/Dockerfile.GitHubActions.Dispatch
Normal file
80
contrib/containers/deploy/Dockerfile.GitHubActions.Dispatch
Normal file
@ -0,0 +1,80 @@
|
||||
# syntax=docker/dockerfile:1.3
|
||||
|
||||
FROM --platform=$BUILDPLATFORM ubuntu:focal as builder
|
||||
RUN apt-get update && \
|
||||
apt-get -y install --no-install-recommends \
|
||||
automake \
|
||||
autotools-dev \
|
||||
bsdmainutils \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
curl \
|
||||
g++-arm-linux-gnueabihf \
|
||||
libtool \
|
||||
pkg-config \
|
||||
python3 \
|
||||
wget \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /dash
|
||||
|
||||
COPY . .
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
RUN case "$TARGETPLATFORM" in \
|
||||
"linux/arm64") make HOST=arm-linux-gnueabihf -C depends -j`nproc | awk '{x=$1/2; print x}'` ;; \
|
||||
"linux/amd64") make HOST=x86_64-pc-linux-gnu -C depends -j`nproc | awk '{x=$1/2; print x}'` ;; \
|
||||
*) exit 1 ;; \
|
||||
esac
|
||||
|
||||
RUN ./autogen.sh && \
|
||||
case "$TARGETPLATFORM" in \
|
||||
"linux/arm64") ./configure --prefix=`pwd`/depends/arm-linux-gnueabihf ;; \
|
||||
"linux/amd64") ./configure --prefix=`pwd`/depends/x86_64-pc-linux-gnu ;; \
|
||||
esac
|
||||
|
||||
RUN make -j`nproc | awk '{x=$1/2; print x}'` && make install
|
||||
|
||||
RUN mkdir built-target && \
|
||||
case "$TARGETPLATFORM" in \
|
||||
"linux/arm64") cp depends/arm-linux-gnueabihf/bin/dash* /dash/built-target ;; \
|
||||
"linux/amd64") cp depends/x86_64-pc-linux-gnu/bin/dash* /dash/built-target ;; \
|
||||
esac
|
||||
|
||||
FROM ubuntu:focal
|
||||
LABEL maintainer="Dash Developers <dev@dash.org>"
|
||||
LABEL description="Dockerised DashCore"
|
||||
|
||||
ARG USER_ID
|
||||
ARG GROUP_ID
|
||||
ARG TAG
|
||||
|
||||
ENV HOME /dash
|
||||
|
||||
# add user with specified (or default) user/group ids
|
||||
ENV USER_ID ${USER_ID:-1000}
|
||||
ENV GROUP_ID ${GROUP_ID:-1000}
|
||||
RUN groupadd -g ${GROUP_ID} dash && \
|
||||
useradd -u ${USER_ID} -g dash -s /bin/bash -m -d /dash dash && \
|
||||
mkdir /dash/.dashcore && \
|
||||
chown dash:dash -R /dash
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install --no-install-recommends \
|
||||
wget \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=builder /dash/built-target/dash* /usr/local/bin
|
||||
|
||||
USER dash
|
||||
|
||||
VOLUME ["/dash"]
|
||||
|
||||
COPY docker/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
EXPOSE 9998 9999 19998 19999
|
||||
|
||||
WORKDIR /dash
|
45
contrib/containers/deploy/Dockerfile.GitHubActions.Gitian
Normal file
45
contrib/containers/deploy/Dockerfile.GitHubActions.Gitian
Normal file
@ -0,0 +1,45 @@
|
||||
# syntax=docker/dockerfile:1.3
|
||||
FROM ubuntu:focal
|
||||
LABEL maintainer="Dash Developers <dev@dash.org>"
|
||||
LABEL description="Dockerised DashCore"
|
||||
|
||||
ARG USER_ID
|
||||
ARG GROUP_ID
|
||||
ARG BRANCH
|
||||
|
||||
ENV HOME /dash
|
||||
|
||||
# add user with specified (or default) user/group ids
|
||||
ENV USER_ID ${USER_ID:-1000}
|
||||
ENV GROUP_ID ${GROUP_ID:-1000}
|
||||
RUN groupadd -g ${GROUP_ID} dash && \
|
||||
useradd -u ${USER_ID} -g dash -s /bin/bash -m -d /dash dash && \
|
||||
mkdir /dash/.dashcore && \
|
||||
chown dash:dash -R /dash
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install --no-install-recommends \
|
||||
wget \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY dashcore-binaries/${BRANCH}/dashcore* /dash
|
||||
|
||||
RUN mach=$(uname -m) \
|
||||
&& case $mach in aarch64) arch="aarch64-linux-gnu"; ;; x86_64) arch="x86_64-linux-gnu"; ;; *) echo "ERROR: Machine type $mach not supported."; ;; esac \
|
||||
&& cd /dash \
|
||||
&& tar xvzf dashcore*$arch.tar.gz \
|
||||
&& echo $(ls -1 /dash) \
|
||||
&& cp dashcore-*/bin/* /usr/local/bin \
|
||||
&& rm -rf dash*
|
||||
|
||||
USER dash
|
||||
|
||||
VOLUME ["/dash"]
|
||||
|
||||
COPY dash/contrib/containers/deploy/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
EXPOSE 9998 9999 19998 19999
|
||||
|
||||
WORKDIR /dash
|
Loading…
Reference in New Issue
Block a user