forked from lwthiker/curl-impersonate
-
-
Notifications
You must be signed in to change notification settings - Fork 129
65 lines (57 loc) · 1.71 KB
/
build-docker.yml
File metadata and controls
65 lines (57 loc) · 1.71 KB
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
name: Build and push docker images
on:
push:
branches:
- main
- feature/*
- bugfix/*
- chore/*
- security/*
tags:
- "v*"
pull_request:
branches:
- main
env:
DOCKER_CLI_EXPERIMENTAL: enabled
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up docker buildx
uses: docker/setup-buildx-action@v1
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Check if tag is present
id: check_tag
run: |
if [[ "${GITHUB_REF}" =~ ^refs/tags/v ]]; then
echo "push_image=true" >> $GITHUB_ENV
echo "image_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "push_image=false" >> $GITHUB_ENV
echo "image_tag=latest" >> $GITHUB_ENV
fi
- name: Build debian docker image
uses: docker/build-push-action@v3
with:
context: .
file: docker/debian.dockerfile
push: ${{ env.push_image }}
tags: |
${{ secrets.DOCKER_USERNAME }}/curl-impersonate:${{ env.image_tag }}
${{ secrets.DOCKER_USERNAME }}/curl-impersonate:latest
- name: Build alpine docker image
uses: docker/build-push-action@v3
with:
context: .
file: docker/alpine.dockerfile
push: ${{ env.push_image }}
tags: |
${{ secrets.DOCKER_USERNAME }}/curl-impersonate:${{ env.image_tag }}-alpine
${{ secrets.DOCKER_USERNAME }}/curl-impersonate:alpine