elgohr / Publish-Docker-Github-Action

A Github Action used to build and publish Docker images
MIT License
782 stars 209 forks source link

[BUG] docker:not found #187

Closed MaticSulc closed 11 months ago

MaticSulc commented 11 months ago

Describe the bug While running an action using the platform tags, it throws /__w/_actions/elgohr/Publish-Docker-Github-Action/v5/entrypoint.sh: 32: /__w/_actions/elgohr/Publish-Docker-Github-Action/v5/entrypoint.sh: docker: not found

To Reproduce

name: Build and Deploy

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
  push:
    branches: [main]
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'
        required: true
        default: 'warning'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    container: node:16

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: Publish to Registry
        uses: elgohr/Publish-Docker-Github-Action@v5
        #env:
          #NEXT_PUBLIC_BACKEND_URL: ${{ secrets.APP_NEXT_PUBLIC_BACKEND_URL }}
          #NEXT_PUBLIC_META_API_KEY: ${{ secrets.APP_NEXT_PUBLIC_META_API_KEY }}
        with:
          name: maticsulc/lorem/ipsum
          registry: ghcr.io
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets. GITHUB_TOKEN }}
          platforms: linux/amd64,linux/arm64
          #buildargs: NEXT_PUBLIC_BACKEND_URL,NEXT_PUBLIC_META_API_KEY
          tags: latest
  deploy:
    needs: build
    runs-on: ubuntu-latest

    steps:
      - name: Deploy package to Github Container Registry
        uses: appleboy/ssh-action@master
        env:
          GITHUB_USERNAME: ${{ secrets.USERNAME }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          host: ${{ secrets.DEPLOY_HOST }}
          port: ${{ secrets.DEPLOY_PORT }}
          username: ${{ secrets.DEPLOY_USER }}
          key: ${{ secrets.DEPLOY_KEY }}
          envs: GITHUB_USERNAME, GITHUB_TOKEN
          script: |
            docker login ghcr.io -u $GITHUB_USERNAME -p $GITHUB_TOKEN
            docker pull ghcr.io/maticsulc/lorem/ipsum:latest
            docker stop loremipsum
            docker system prune -f
            docker run --name loremipsum -dit -p 3000:3000 ghcr.io/maticsulc/lorem/ipsum:latest

Expected behavior No error, and successful deployment.

elgohr commented 11 months ago

Looks like your environment (container) is missing docker. This is not a bug regarding this action.

See

name: Build and Deploy

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
  push:
    branches: [main]
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'
        required: true
        default: 'warning'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    container: node:16

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - run: docker ps

errors as docker: not found (https://github.com/elgohr/test/actions/runs/6901303639/job/18775880567)