mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-14 05:23:09 +00:00
docker workflow
This commit is contained in:
55
.github/workflows/docker.yml
vendored
55
.github/workflows/docker.yml
vendored
@@ -7,7 +7,7 @@ on:
|
||||
project:
|
||||
description: 'Project'
|
||||
required: true
|
||||
default: ''
|
||||
default: 'x-ui'
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -20,30 +20,39 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
# list of Docker images to use as base name for tags
|
||||
images: |
|
||||
alireza7/x-ui
|
||||
ghcr.io/alireza0/x-ui
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
|
||||
- name: Docker Hub login
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
run: |
|
||||
echo "${DOCKERHUB_TOKEN}" | docker login --username ${DOCKERHUB_USERNAME} --password-stdin
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v1
|
||||
with:
|
||||
buildx-version: latest
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build Dockerfile
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
DOCKERHUB_REPO: ${{ secrets.DOCKER_HUB_REPOSITORY }}
|
||||
run: |
|
||||
docker buildx build \
|
||||
--platform=linux/amd64,linux/arm64 \
|
||||
--output "type=image,push=true" \
|
||||
--file ./Dockerfile ./ \
|
||||
--tag $(echo "${DOCKERHUB_USERNAME}" | tr '[:upper:]' '[:lower:]')/${{ github.event.inputs.project }}:latest
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
Reference in New Issue
Block a user