简体   繁体   English

从 Github 创建 Docker 映像并发布到 Hub

[英]Create Docker Image From Github and Publish to Hub

My github repository link is https://github.com/ferdasonmez/oyente .我的 github 存储库链接是https://github.com/ferdasonmez/oyente I forked a github site and made sme changes on some lib versions.我分叉了一个 github 站点,并对一些 lib 版本进行了一些更改。 Now I want to push it to Docker.现在我想把它推到 Docker。 I already created a repository under my docker account.我已经在我的 docker 帐户下创建了一个存储库。 ferdaozdemir/oyente费尔道兹德米尔/奥扬特

Using the below yml file, I am trying to create the image but nothing happens.使用下面的 yml 文件,我正在尝试创建图像但没有任何反应。 I already created the secrets for Docker under Github settings.我已经在 Github 设置下创建了 Docker 的秘密。 This can easily be recreated by forking the repository and entering your own secrets.这可以通过分叉存储库并输入您自己的秘密轻松地重新创建。

name: Build Docker Container Image
on: push
jobs:
  build-container:
    name: Build container
    runs-on: ubuntu-latest
    steps:
      - name: Push to Docker Hub
        uses: docker/build-push-action@v1
        with:
          username: ${{ secrets.DOCKER_USER_NAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
          repository: ferdaozdemir/oyente
          tags: latest

You may be missing steps.您可能缺少步骤。 I have some repos with a similar setup ( ie Dockerfile in the top-level directory) but I also run steps to我有一些具有类似设置的存储库(顶级目录中的Dockerfile ),但我也运行步骤

  • checkout查看
  • build (where I now use buildx)构建(我现在使用 buildx)
  • log into the Docker Hub登录 Docker 集线器
  • build and push构建和推动
  • and also report and commit a timestamp (to force cache changes)并报告并提交时间戳(强制缓存更改)

I include one of these below (source is here . It may not be the most minimal setup but it had been working for me quite reliably, including via scheduled ( ie cron ) actions. I am skipping the last two items here (see here for the complete file):我在下面包括其中之一(来源在这里。它可能不是最小的设置,但它对我来说非常可靠,包括通过预定的(cron )操作。我在这里跳过最后两项(请参阅这里完整的文件):

name: docker
on:
  push:
  schedule:
  - cron: "22 2 * * 1"
    
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    #- name: Set up QEMU
    #  uses: docker/setup-qemu-action@v1

    - name: Buildx
      uses: docker/setup-buildx-action@v1

    - name: Login
      uses: docker/login-action@v1
      with:
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_PASSWORD }}
        
    - name: Build and push
      uses: docker/build-push-action@v2
      with:
        context: .
        push: true
        tags: rocker/drd:latest

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM