Skip to content

Commit

Permalink
docker-ci
Browse files Browse the repository at this point in the history
github docker 不支持多架构
  • Loading branch information
NewFuture committed Aug 3, 2020
1 parent 803008b commit 0ba8823
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 100 deletions.
78 changes: 0 additions & 78 deletions .github/workflows/ci.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/docker-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Github Docker

on:
push:
branches:
- master
- dev
- edge
pull_request:
branches:
- master

jobs:
docker-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build and push Docker images to test docker
if: github.event_name == 'pull_request'
uses: docker/[email protected]
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: newfuture/ddns/preview-ddns
tag_with_ref: true
add_git_labels: true
- name: Build and push Docker images to release docker
uses: docker/[email protected]
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: newfuture/ddns/ddns
tag_with_ref: true
add_git_labels: true


43 changes: 43 additions & 0 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: dockerhub release

# build master with multi-arch to docker hub

on:
push:
branches:
- master

jobs:
buildx-dockerhub:
runs-on: ubuntu-latest
env:
DOCKER_REPO: newfuture/ddns
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_PLATFORMS: linux/amd64,linux/arm,linux/arm64
DOCKER_REGISTRY: ""
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v3
- name: Prepare arguments
id: prepare
run: |
DOCKER_TAGS="--tag ${DOCKER_REPO}:latest"
if [[ $GITHUB_REF == refs/tags/v* ]]; then
DOCKER_TAGS="${DOCKER_TAGS} --tag ${DOCKER_REPO}:${GITHUB_REF#refs/tags/}"
fi
echo ::set-output name=buildx_args:: --output "type=image,push=true" --platform ${DOCKER_PLATFORMS} ${DOCKER_TAGS} .
- name: Docker login
run: |
echo "${DOCKER_PASSWORD}" | docker login "${DOCKER_REGISTRY}" \
--username "${DOCKER_USERNAME}" \
--password-stdin
- name: Run buildx and push
if: success()
run: docker buildx build ${{ steps.prepare.outputs.buildx_args }}
- name: Docker Hub logout
if: always()
run: docker logout
22 changes: 0 additions & 22 deletions .github/workflows/pr-docker.yml

This file was deleted.

0 comments on commit 0ba8823

Please sign in to comment.