From d416c6962abcc2279f349dee58ded3c25933b177 Mon Sep 17 00:00:00 2001 From: Philipp Hoenisch Date: Tue, 12 Oct 2021 16:28:38 +1100 Subject: [PATCH] Provide dockerfile and build during release Dockerfile are generally useful but are especially needed in our case because we depend on a glibc2.29 which is not available on older distros --- .dockerignore | 3 ++ .github/workflows/build-release-binary.yml | 36 ++++++++++++++++++++++ Dockerfile | 15 +++++++++ 3 files changed, 54 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..bd674b6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ + +.* +!./target \ No newline at end of file diff --git a/.github/workflows/build-release-binary.yml b/.github/workflows/build-release-binary.yml index dc43ddb..2527303 100644 --- a/.github/workflows/build-release-binary.yml +++ b/.github/workflows/build-release-binary.yml @@ -14,42 +14,52 @@ jobs: target: x86_64-unknown-linux-gnu os: ubuntu-latest archive_ext: tar + docker_platforms: linux/amd64 - bin: taker target: armv7-unknown-linux-gnueabihf os: ubuntu-latest archive_ext: tar + docker_platforms: linux/arm/v7 - bin: taker target: aarch64-unknown-linux-gnu os: ubuntu-latest archive_ext: tar + docker_platforms: linux/arm64 - bin: taker target: x86_64-apple-darwin os: macos-latest archive_ext: tar + docker_platforms: None - bin: taker target: x86_64-pc-windows-msvc os: windows-latest archive_ext: zip + docker_platforms: None - bin: maker target: x86_64-unknown-linux-gnu os: ubuntu-latest archive_ext: tar + docker_platforms: linux/amd64 - bin: maker target: armv7-unknown-linux-gnueabihf os: ubuntu-latest archive_ext: tar + docker_platforms: linux/arm64 - bin: maker target: aarch64-unknown-linux-gnu os: ubuntu-latest archive_ext: tar + docker_platforms: linux/arm64 - bin: maker target: x86_64-apple-darwin os: macos-latest archive_ext: tar + docker_platforms: None - bin: maker target: x86_64-pc-windows-msvc os: windows-latest archive_ext: zip + docker_platforms: None runs-on: ${{ matrix.os }} steps: - name: Checkout tagged commit @@ -144,3 +154,29 @@ jobs: asset_path: ./${{ steps.create-archive-name.outputs.archive }} asset_name: ${{ steps.create-archive-name.outputs.archive }} asset_content_type: application/gzip + + - name: Set up QEMU + if: matrix.os != 'windows-latest' && matrix.os != 'macos-latest' + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + if: matrix.os != 'windows-latest' && matrix.os != 'macos-latest' + uses: docker/setup-buildx-action@v1 + + - name: Login into github registry + uses: docker/login-action@v1.10.0 + if: matrix.os != 'windows-latest' && matrix.os != 'macos-latest' + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and publish docker image + if: matrix.os != 'windows-latest' && matrix.os != 'macos-latest' + run: | + docker buildx build \ + --push \ + --platform=${{ matrix.docker_platforms }} \ + --tag ghcr.io/${{ github.actor }}/hermes-${{ matrix.bin }}-${{ matrix.target }} \ + --build-arg BINARY_PATH=target/${{ matrix.target }}/release/${{ matrix.bin }} \ + . diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c0a4f38 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM debian:bullseye-slim + +ARG BINARY_PATH +RUN echo "Copying $BINARY_PATH into container" + +COPY $BINARY_PATH hermes + +RUN chmod a+x hermes + +VOLUME data + +# HTTP Port and P2P Port +EXPOSE 8000 9999 + +ENTRYPOINT ["/hermes", "--data-dir=/data", "--http-address=0.0.0.0:8000"]