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 7a36926
Showing 1 changed file with 42 additions and 44 deletions.
86 changes: 42 additions & 44 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
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
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/m1guelpf/orbit-server
ghcr.io/m1guelpf/${{ matrix.image }}
tags: |
type=sha
type=edge
Expand All @@ -30,59 +39,48 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
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
uses: docker/build-push-action@v6
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
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-unknown-linux-musl

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
- name: Build
uses: actions-rs/cargo@v1
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}}
command: build
args: '--release --bins'

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
- name: Upload orbit-server binary
uses: actions/upload-artifact@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
name: orbit-server
path: target/release/orbit-server

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
- name: Upload orbit-cli binary
uses: actions/upload-artifact@v4
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 }}
name: orbit-cli
path: target/release/orbit-cli

0 comments on commit 7a36926

Please sign in to comment.