fix multiplatform build, #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
push: | |
branches: [ "master", "dev" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
IMAGE_NAME: gnzsnz/jupyter-quant | |
PLATFORMS: linux/amd64,linux/arm64 | |
jobs: | |
buildntest: | |
name: Build and test | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get enviroment variables | |
run: | | |
grep -v '#' .env-dist | grep '=' > .env | |
while IFS= read -r line; do | |
echo $line >> $GITHUB_ENV ; | |
done < .env | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: ${{ env.PLATFORMS }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ env.IMAGE_NAME }} | |
ghcr.io/${{ env.IMAGE_NAME }} | |
flavor: | | |
latest=true | |
- name: Build Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
push: false | |
load: false | |
context: . | |
platforms: ${{ env.PLATFORMS }} | |
build-args: | | |
USER=${{ env.USER }} | |
USER_ID=${{ env.USER_ID }} | |
USER_GID=${{ env.USER_GID }} | |
PYTHON_VERSION=${{ env.PYTHON_VERSION}} | |
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }} |