New location of docker actions

后端 未结 1 1194
渐次进展
渐次进展 2020-12-16 08:17

I was using this for docker:

- name: Build container image
  uses: actions/docker/cli@master
  with:
    ///// removed

- name: Docker Login
  uses: actions/         


        
相关标签:
1条回答
  • 2020-12-16 08:41

    The actions/docker action has now been deprecated. The repository was archived with the following message before being deleted entirely.

    This action is deprecated in favor of using the run script step in the new YAML language to run the docker cli.

    So the recommended way to use Docker is to use the run script command. The official starter workflow shows a simple example to build an image. https://github.com/actions/starter-workflows/blob/master/ci/docker-image.yml

    For more complete examples of Docker image publishing see the following workflows.

    For the public DockerHub registry:

    name: my workflow
    on:
      push:
        branches:
          - master
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - name: Login to DockerHub Registry
            run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
          - name: Build the Docker image
            run: docker build -t myimage:latest .
          - name: Tag the Docker image
            run: docker tag myimage:latest myimage:1.0
          - name: Push the Docker image to the registry
            run: docker push myimage:1.0
    

    For a private registry, such as the new GitHub Package Registry, you also need to specify the hostname when logging in and tag the image appropriately:

    name: my workflow
    on:
      push:
        branches:
          - master
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - name: Login to GitHub Package Registry
            run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.repository }} --password-stdin
          - name: Build the Docker image
            run: docker build -t myimage:latest .
          - name: Tag the Docker image
            run: docker tag myimage:latest docker.pkg.github.com/username/repository/myimage:1.0
          - name: Push the Docker image to the registry
            run: docker push docker.pkg.github.com/username/repository/myimage:1.0
    
    0 讨论(0)
提交回复
热议问题