mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Docker release CI (#4051)
* feat:add github actions * add release tag * multi-arch download * remove erroneous add command * install wget properly * parse tag * no multi-arch for now * show vars * more debug * show uname * install certs * manually mutate tag * fix syntax * use env * remove debug * try docker meta * try semver with v * multi-arch * remove v * use tag-match * match group 1 * prepare for dashpay repo * optimize dockerfile * remove unnecessary space Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * Update .github/workflows/release_docker_hub.yml Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
567909403c
commit
fb311468b7
66
.github/workflows/release_docker_hub.yml
vendored
Normal file
66
.github/workflows/release_docker_hub.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
name: Release to Docker Hub
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release to Docker Hub
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- 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:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Docker meta
|
||||
id: docker_meta
|
||||
uses: crazy-max/ghaction-docker-meta@v1
|
||||
with:
|
||||
images: dashpay/dashd
|
||||
tag-match: v(.*)
|
||||
tag-match-group: 1
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ./docker
|
||||
file: ./docker/Dockerfile.GitHubActions
|
||||
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
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
39
docker/Dockerfile.GitHubActions
Normal file
39
docker/Dockerfile.GitHubActions
Normal file
@ -0,0 +1,39 @@
|
||||
FROM ubuntu:bionic
|
||||
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/*
|
||||
|
||||
RUN mach=$(uname -m) \
|
||||
&& case $mach in armv7l) arch="arm-linux-gnueabihf"; ;; aarch64) arch="aarch64-linux-gnu"; ;; x86_64) arch="x86_64-linux-gnu"; ;; *) echo "ERROR: Machine type $mach not supported."; ;; esac \
|
||||
&& wget https://github.com/dashpay/dash/releases/download/v${TAG}/dashcore-${TAG}-$arch.tar.gz -P /tmp \
|
||||
&& tar -xvf /tmp/dashcore-*.tar.gz -C /tmp/ \
|
||||
&& cp /tmp/dashcore*/bin/* /usr/local/bin \
|
||||
&& rm -rf /tmp/dashcore* \
|
||||
&& chmod a+x /usr/local/bin/*
|
||||
|
||||
USER dash
|
||||
|
||||
VOLUME ["/dash"]
|
||||
|
||||
EXPOSE 9998 9999 19998 19999
|
||||
|
||||
WORKDIR /dash
|
Loading…
Reference in New Issue
Block a user