name: Publish Docker images on: workflow_dispatch: push: paths: - VERSION branches: - main jobs: docker: runs-on: ubuntu-latest steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - uses: actions/checkout@v4 - name: Fetch versions in the repo id: fetch-versions run: | ASTER_VERSION=$(cat VERSION) RUST_VERSION=$(grep -m1 -o 'nightly-[0-9]\+-[0-9]\+-[0-9]\+' rust-toolchain.toml) echo "aster_version=$ASTER_VERSION" >> "$GITHUB_OUTPUT" echo "rust_version=$RUST_VERSION" >> "$GITHUB_OUTPUT" - name: Generate Dockerfile run: | sudo apt-get update sudo apt-get install -y python3-jinja2 python3 ./tools/docker/gen_dockerfile.py - name: Build and push development image uses: docker/build-push-action@v4 with: context: . file: ./tools/docker/Dockerfile platforms: linux/amd64 push: true tags: asterinas/asterinas:${{ steps.fetch-versions.outputs.aster_version }} build-args: | "ASTER_RUST_VERSION=${{ steps.fetch-versions.outputs.rust_version }}" - name: Generate Dockerfile for Intel TDX run: | python3 ./tools/docker/gen_dockerfile.py --intel-tdx - name: Build and push development image for Intel TDX uses: docker/build-push-action@v4 with: context: . file: ./tools/docker/Dockerfile platforms: linux/amd64 push: true tags: asterinas/asterinas:${{ steps.fetch-versions.outputs.aster_version }}-tdx build-args: | "ASTER_RUST_VERSION=${{ steps.fetch-versions.outputs.rust_version }}" - name: Generate OSDK Dockerfile run: | python3 ./osdk/tools/docker/gen_dockerfile.py - name: Build and push OSDK test image uses: docker/build-push-action@v4 with: context: . file: ./osdk/tools/docker/Dockerfile platforms: linux/amd64 push: true tags: asterinas/osdk:${{ steps.fetch-versions.outputs.aster_version }} build-args: | "ASTER_RUST_VERSION=${{ steps.fetch-versions.outputs.rust_version }}" - name: Generate OSDK Dockerfile for Intel TDX run: | python3 ./osdk/tools/docker/gen_dockerfile.py --intel-tdx - name: Build and push OSDK test image for Intel TDX uses: docker/build-push-action@v4 with: context: . file: ./osdk/tools/docker/Dockerfile platforms: linux/amd64 push: true tags: asterinas/osdk:${{ steps.fetch-versions.outputs.aster_version }}-tdx build-args: | "ASTER_RUST_VERSION=${{ steps.fetch-versions.outputs.rust_version }}"