Skip to content

Commit

Permalink
Testing docker again
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatson committed Aug 26, 2024
1 parent 1104176 commit f1811cd
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/test-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test docker build push

on:
push:
branches:
- docker-2

env:
CARGO_TERM_COLOR: always

jobs:
cross-compile-on-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Make a directory for output artifacts
run: mkdir -p target/artifacts

- name: install linux cross compiler
run: brew tap messense/macos-cross-toolchains &&
brew install x86_64-unknown-linux-musl

- name: Build release linux x86_64 binary
run: rustup target install x86_64-unknown-linux-musl &&
make release-linux-x86_64 &&
mv target/x86_64-unknown-linux-musl/release-github/rqbit target/artifacts/rqbit-linux-static-x86_64

- name: Archive the binary artifact
uses: actions/upload-artifact@v4
with:
name: rqbit-linux-static-x86_64
path: output/rqbit-linux-static-x86_64

build-push-docker:
runs-on: ubuntu-latest
needs: cross-compile-on-macos
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: rqbit-linux-static-x86_64
path: target/x86_64/rqbit

- name: chmod +x
run: chmod +x target/x86_64/rqbit

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ikatson/rqbit:${{ GITHUB_REF_NAME }}
context: target/x86_64/
platforms: linux/amd64
file: docker/Dockerfile
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ release-linux-x86_64:
CROSS_COMPILE_PREFIX=x86_64-unknown-linux-musl \
$(MAKE) release-linux-current-target

@PHONY: docker-x86_64
docker-x86_64:
docker build \
-f docker/Dockerfile \
-t ikatson/rqbit:$(shell git describe --tags) \
--platform linux/amd64 \
target/x86_64-unknown-linux-musl/release-github/

@PHONY: release-linux-aarch64
release-linux-aarch64:
TARGET=aarch64-unknown-linux-gnu \
Expand Down

0 comments on commit f1811cd

Please sign in to comment.