Skip to content

(feat!): end to end working #1

(feat!): end to end working

(feat!): end to end working #1

name: Build Apache Spark with Jupyter Notebook
on:
push:
branches: [main]
tags: ["v*.*.*"]
paths-ignore:
- README.md
- LICENSE
- .gitignore
- .tools-version
- docker-compose.yml
pull_request:
branches: [main]
workflow_dispatch:
env:
REGISTRY: ghcr.io
JAVA_VERSION: 17
SPARK_VERSION: 3.5.4
HADOOP_VERSION: 3
jobs:
build-and-push:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.tags.outputs.tags }}
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set lowercase image name
run: |
echo "IMAGE_NAME=$(echo ${{ github.repository }}/spark35notebook | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Generate tags
id: tags
run: |
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
echo "tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag-suffix }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag-suffix }}-${VERSION}" >> $GITHUB_OUTPUT
else
echo "tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag-suffix }}" >> $GITHUB_OUTPUT
fi
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: pyspark-notebook
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.tags.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
spark_version=${{ env.SPARK_VERSION }}
openjdk_version=${{ env.JAVA_VERSION }}
hadoop_version=${{ env.HADOOP_VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max