在 GitHub 个操作中使用 docker 个文件

Use of docker files in GitHub Actions

我想在 Github 操作中使用 pandoc 从 Markdown 文件生成 pdf。为此,我打算使用现有的 Docker 容器来提高性能。但不幸的是,我无法通过添加相应的容器引用(删除第 6 行中的 #)来简单地在本机 ubuntu-latestpandoc/latex:2.9 之间切换。在这种情况下,我收到了一条没有 pandoc 容器就不会发生的意外错误消息。

name: Execute_pandoc
on: [push]

jobs:
  Run_pandoc:
    runs-on: ubuntu-latest
    #container: pandoc/latex:2.16

    steps:
      - name: Illustrate the problem
        run: |
             echo "Hello World"
             dirlist=(`ls *`)

Run echo "Hello World"
Hello World
/__w/_temp/2ac5de2c-2847-4b00-8a97-ba3bb034898e.sh: line 2: syntax error: unexpected "("
Error: Process completed with exit code 2.

您遇到的语法错误是因为 shell 不理解您的命令。尝试设置不同的 shell 或更改命令。

请记住,在您的示例中 pandoc/latex 的基础图像是 alpine,它使用 ash。您可以简单地使用另一个基于其他发行版的 pandoc 图像。

这是一个例子:

name: Execute_pandoc
on: [push]

jobs:
  Run_pandoc:
    runs-on: ubuntu-latest
    container: pandoc/ubuntu-latex
    steps:
      - name: Illustrate the problem
        run: |
             echo "Hello World"
             dirlist=(`ls /*`)
             echo ${dirlist[@]}
        shell: bash