Skip to content

Commit

Permalink
Build base binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
m1guelpf committed Jul 23, 2024
1 parent 600af02 commit 3dd2d7f
Showing 1 changed file with 32 additions and 49 deletions.
81 changes: 32 additions & 49 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,88 +1,71 @@
name: Build Docker images
name: Build
on:
push:
branches: [main]

branches:
- main
permissions:
contents: read
packages: write

jobs:
build-server:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- image: orbit-server
dockerfile: ./Dockerfile.server
- image: orbit-cli
dockerfile: ./Dockerfile.cli
steps:
- uses: actions/checkout@v3

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/m1guelpf/orbit-server
ghcr.io/m1guelpf/${{ matrix.image }}
tags: |
type=sha
type=edge
type=semver,pattern={{major}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

username: '${{ github.actor }}'
password: '${{ secrets.GITHUB_TOKEN }}'
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
context: .
cache-from: type=gha
file: ./Dockerfile.server
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-cli:
cache-to: 'type=gha,mode=max'
file: '${{ matrix.dockerfile }}'
tags: '${{ steps.meta.outputs.tags }}'
labels: '${{ steps.meta.outputs.labels }}'
binaries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
images: |
ghcr.io/m1guelpf/orbit-cli
tags: |
type=sha
type=edge
type=semver,pattern={{major}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
toolchain: stable
target: x86_64-unknown-linux-musl
- name: Build
uses: actions-rs/cargo@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
command: build
args: '--release --bins'
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
push: true
context: .
cache-from: type=gha
file: ./Dockerfile.cli
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
path: |
target/x86_64-unknown-linux-musl/release/orbit-cli
target/x86_64-unknown-linux-musl/release/orbit-server

0 comments on commit 3dd2d7f

Please sign in to comment.