Home > Software design >  Use of docker files in GitHub Actions
Use of docker files in GitHub Actions

Time:12-18

I want to use pandoc to generate pdfs from Markdown files in a Github Action. For this purpose, I intended to use an existing Docker container to improve performance. But unfortunately, I could not simply switch between a native ubuntu-latest and pandoc/latex:2.9 by adding a corresponding container reference (deleting the # in line 6). In this case, I received an unexpected error message that did not occur without the pandoc container.

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.

CodePudding user response:

The syntax error you're getting is because shell doesn't understand your command. Try setting different shell or change command.

Keep in mind that base image for pandoc/latex in your example is alpine which uses ash. You could simply use another pandoc image that's based on some other distro.

Here's an example:

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
  • Related