Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how apply self-signed cert option ? #782

Closed
Fhwang0926 opened this issue Jan 29, 2023 · 3 comments
Closed

how apply self-signed cert option ? #782

Fhwang0926 opened this issue Jan 29, 2023 · 3 comments

Comments

@Fhwang0926
Copy link

Troubleshooting

Before submitting a bug report please read the Troubleshooting doc.

Behaviour

Expected behaviour

no have issue, docker image push succesful

Actual behaviour

can not verify to self-sign certification in qemu

Configuration

  • Repository URL (if public): private
  • Build URL (if public): private
name: Manually Release Previous Tag

on: 
  push:
    branches: [ 'master' ]
  workflow_dispatch:
    inputs:
      tag:
        description: 'Repo Branch/Tag'
        default: 'main'
        type: 'string'
        required: true

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout'
        uses: actions/checkout@v3
        with: 
          ref: ${{ inputs.tag }}
      - name: Prepare
        id: prep
        run: |
          # DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPOSITORY#*/}
          DOCKER_IMAGE=${{ secrets.DOCKER_REGISTRY }}/seo/seo-proxy-shell
          # ${GITHUB_REPOSITORY#*/}
          # :${{ inputs.tag }}

          VERSION=${{ inputs.tag }}
          VERSION="${VERSION//v}"
          TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}"

          # If the VERSION looks like a version number, assume that
          # this is the most recent version of the image and also
          # tag it 'latest'.
          if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
            TAGS="$TAGS,${DOCKER_IMAGE}"
          fi
          
          echo  ${{ steps.prep.outputs.tags }}
          echo  ${TAGS}
          echo  ${DOCKER_IMAGE}


          # Set output parameters.
          echo ::set-output name=tags::${TAGS}
          echo ::set-output name=docker_image::${DOCKER_IMAGE}

      - name: Set up QEMU
        uses: docker/setup-qemu-action@master
        with:
          platforms: all

      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@master
      
      - name: set cert
        run: |
          bash app/cert.sh
          echo ${{ steps.prep.outputs.tags }}
        

      - name: Login to DockerHub
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v1
        with:
          registry: ${{ secrets.DOCKER_REGISTRY }}
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Build
        uses: docker/build-push-action@v2
        with:
          builder: ${{ steps.buildx.outputs.name }}
          context: .
          file: ./Dockerfile
          platforms: linux/amd64,linux/arm64,linux/ppc64le
          push: true
          # tags: ${{ steps.prep.outputs.tags }}
          tags: ${{ steps.prep.outputs.docker_image }}
      
      #- name: Push the tagged Docker image
      #  run: docker push harbor.donghwa.dev:4443/seo/${GITHUB_REPOSITORY#*/}:latest
#!/bin/bash
sudo mkdir -p /etc/docker/certs.d/[domain]
sudo openssl s_client -showcerts -connect [domain]:4443 < /dev/null | sudo sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > [domain].crt
sudo cat [domain].crt
sudo cp [domain].crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
sudo systemctl restart docker
sudo docker info

Logs

Download the log file of your build and attach it to this issue.

image

@crazy-max
Copy link
Member

You need to set the registry certificates in BuildKit, not Docker: https://docs.docker.com/build/buildkit/configure/#setting-registry-certificates

See also docker/setup-buildx-action#112 (comment) to set up buildx with BuildKit configuration.

@crazy-max
Copy link
Member

@dvdksn Maybe we could have this documented in https://docs.docker.com/build/ci/github-actions/examples/ WDYT?

@Fhwang0926
Copy link
Author

@crazy-max thanks!! and i also agree comment into document

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants