You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub Actions构建自定义Alpine ISO后文件无法访问问题

GitHub Actions构建自定义Alpine Linux ISO的文件访问问题

我正在使用GitHub Actions构建自定义Alpine Linux ISO。ISO已在Alpine容器内的~/iso目录成功生成,但后续尝试访问或复制该文件时遇到问题,提示ISO文件未找到或无法访问。

以下是我的GitHub Actions工作流文件相关部分:

name: Build Custom Alpine ISO

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          submodules: true
    
      - name: Setup Alpine Linux environment
        uses: jirutka/setup-alpine@v1
        with:
          branch: edge
    
      - name: Install required packages and build ISO
        shell: alpine.sh --root {0}
        run: |
          apk add --no-cache alpine-sdk alpine-conf syslinux xorriso squashfs-tools grub grub-efi doas alpine-base busybox openrc bash agetty
          echo "permit nopass root" | tee -a /etc/doas.conf
          abuild-keygen -i -a -n -q
          apk update
          mkdir -p ~/tmp ~/iso
          export TMPDIR=~/tmp
          cp -rf custom/* aports/scripts/
          cp ./custom/pppwn.tar.gz aports/scripts/
          chmod +x aports/scripts/*
          
          echo "Running mkimage.sh script..."
          sh aports/scripts/mkimage.sh --tag edge --outdir ~/iso --arch x86_64 --repository https://dl-cdn.alpinelinux.org/alpine/edge/main --profile pppwn

          echo "Listing files in ~/iso after ISO creation:"
          ls -l ~/iso/
      
      - name: Ensure target directory exists
        run: |
          mkdir -p /home/runner/iso/
        
      - name: Copy ISO to shared location
        run: |
          echo "Copying ISO files from ~/iso/ to /home/runner/iso/"
          cp ~/iso/*.iso /home/runner/iso/
        
      - name: Check if ISO was copied and exists
        run: |
          echo "Listing files in /home/runner/iso:"
          ls -l /home/runner/iso/
          if [ -z "$(ls -A /home/runner/iso/*.iso 2>/dev/null)" ]; then
            echo "ISO not found in shared location. Exiting."
            exit 1
          fi

      - name: Upload ISO artifact
        uses: actions/upload-artifact@v4
        with:
          name: pppwn-live-iso
          path: /home/runner/iso/*.iso

如容器内ls命令输出所示,ISO文件alpine-pppwn-edge-x86_64.iso已正确生成于~/iso目录,但容器外无法找到该文件。

我已尝试:

  • 确保复制前目标目录/home/runner/iso/已存在;
  • 验证构建步骤后~/iso/目录中确实存在ISO文件;
  • 调整工作流中的路径以保持一致和正确。

内容的提问来源于stack exchange,提问作者zen2818

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 19:07:10