dendrite/.github/workflows/cross-compiling-docker.yml
2021-01-18 12:51:54 -05:00

56 lines
1.7 KiB
YAML

name: "(Cross) Compile Dendrite"
# dummy
on: push
jobs:
compile:
strategy:
matrix:
target: [amd64, arm64, arm]
env:
GOARCH: ${{ matrix.target }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- name: install (cross) compiler
run: sudo apt install $(./.github/workflows/get-compiler.sh pkgs)
- name: set CC env var
run: echo "CC=$(./.github/workflows/get-compiler.sh ccomp)" >> $GITHUB_ENV # https://stackoverflow.com/a/57969570/3551604
- run: go env
- run: ./build.sh
- name: upload build artifacts
uses: actions/upload-artifact@v2
with:
name: bin-${{ matrix.target }}
path: ./bin
build-monolith:
strategy:
matrix:
target: [amd64, arm64, arm]
env:
DOCKER_HUB_USER: dendritegithub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: bin-${{ matrix.target }}
# - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- run: echo "DOCKER_TARGET=$(./.github/workflows/get-compiler.sh docker)" >> $GITHUB_ENV
# For building docker images, QEMU and buildx is still easier than anything to do with docker manifest editing
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
uses: docker/build-push-action@v2
with:
context: .
file: ./build/docker/Dockerfile.monolith
platforms: ${{ env.PLATFORMS }}
push: false
tags: |
${{ env.DOCKER_NAMESPACE }}/dendrite-monolith:latest