Skip to content

Commit

Permalink
Use if condition on docker run command since one-liner doesn't work.
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffano committed Jul 28, 2024
1 parent 5dc9bad commit b35d3b8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ runs:
shell: sh
run: |
cd $GITHUB_ACTION_PATH && docker build -f Dockerfile --build-arg IMAGE=${{ inputs.image }} --build-arg SHELL=${{ inputs.shell }} -t local_image:8.8.8 .
- name: Deploy on pushes

run: echo 'DEPLOY=true' >> "$GITHUB_ENV"
- name: Run Docker container on the GitHub Workspace directory
if: inputs.env_file == ''
shell: sh
run: |
cd $GITHUB_WORKSPACE && docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v .:/opt/workspace/ ${{ inputs.env_file != '' && '--env-file' }} "${{ inputs.env_file }}" --name local_container local_image:8.8.8 "${{ inputs.command }}"
cd $GITHUB_WORKSPACE && docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v .:/opt/workspace/ --name local_container local_image:8.8.8 "${{ inputs.command }}"
- name: Run Docker container on the GitHub Workspace directory with env file
if: inputs.env_file != ''
shell: sh
run: |
cd $GITHUB_WORKSPACE && docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v .:/opt/workspace/ --env-file "${{ inputs.env_file }}" --name local_container local_image:8.8.8 "${{ inputs.command }}"

0 comments on commit b35d3b8

Please sign in to comment.