-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
96 lines (85 loc) Β· 3 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: π³ Publish Docker Image
on:
workflow_dispatch:
push:
branches:
- main
- master
tags:
- '*'
paths:
- src/**
- api/**
- public/**
- Dockerfile
env:
IMAGE_NAME: web-check
DOCKER_USER: lissy93
GHCR_REGISTRY: ghcr.io
DOCKERHUB_REGISTRY: docker.io
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout ποΈ
uses: actions/checkout@v4
- name: Extract tag name π·οΈ
shell: bash
run: echo "GIT_TAG=$(echo ${GITHUB_REF#refs/tags/} | sed 's/\//_/g')" >> $GITHUB_ENV
- name: Compute tags π
id: compute-tags
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "GHCR_TAG=${GHCR_REGISTRY}/${DOCKER_USER}/${IMAGE_NAME}:latest" >> $GITHUB_ENV
echo "DOCKERHUB_TAG=${DOCKERHUB_REGISTRY}/${DOCKER_USER}/${IMAGE_NAME}:latest" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "GHCR_TAG=${GHCR_REGISTRY}/${DOCKER_USER}/${IMAGE_NAME}:${GIT_TAG}" >> $GITHUB_ENV
echo "DOCKERHUB_TAG=${DOCKERHUB_REGISTRY}/${DOCKER_USER}/${IMAGE_NAME}:${GIT_TAG}" >> $GITHUB_ENV
fi
- name: Set up QEMU π§
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx π³
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry π
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub π
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKERHUB_REGISTRY }}
username: ${{ env.DOCKER_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Docker images π οΈ
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64/v8
tags: |
${{ env.GHCR_TAG }}
${{ env.DOCKERHUB_TAG }}
- name: ποΈ Make Docker Meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ env.DOCKERHUB_REGISTRY }}/${{ env.DOCKER_USER }}/${{ env.IMAGE_NAME }}
${{ env.GHCR_REGISTRY }}/${{ env.DOCKER_USER }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=semver,pattern={{version}},enable=true
type=semver,pattern={{major}}.x
type=raw,value=latest
flavor: |
latest=false
labels: |
maintainer=Lissy93
org.opencontainers.image.title=Web Check
org.opencontainers.image.description=Xray Vision for any Website
org.opencontainers.image.documentation=https://web-check.xyz
org.opencontainers.image.authors=Alicia Sykes
org.opencontainers.image.licenses=MIT