diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml new file mode 100644 index 0000000..d6d70e5 --- /dev/null +++ b/.github/workflows/publish-docker.yml @@ -0,0 +1,36 @@ +name: Publish Docker Image + +on: + push: + +concurrency: + group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true + +env: + IMAGE_NAME: commune + GHCR_REGISTRY: ghcr.io/commune-os + +jobs: + publish_image: + name: Publish image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Rust Toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: x86_64-unknown-linux-musl + + - name: Install Just + uses: extractions/setup-just@v1 + + - name: Build Server + run: just build_server diff --git a/Justfile b/Justfile index e8482e7..41647fa 100644 --- a/Justfile +++ b/Justfile @@ -60,3 +60,12 @@ clear: stop # Runs all the tests from the `test` package. Optionally runs a single one if name pattern is provided e2e *args='': cargo test --package test -- --nocapture --test-threads=1 $1 + +# Builds the Server binary used in the Docker Image +build_server: + cargo build --release -p server --target x86_64-unknown-linux-musl + ls ./target/x86_64-unknown-linux-musl/release + +# Builds the Docker image for the backend +build_image *args='latest': build_server + docker build -t "commune:$1-aarch64-unknown-linux-musl" .