-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (45 loc) · 1.56 KB
/
build-docker-image.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
name: docker image build
run-name: ${{ github.actor }} build new images 🚀
on: [push]
jobs:
buildx:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: echo all dockerfiles
run: |
ls -d ${{ github.workspace }}/dockerfiles/*/ | awk -F '/' '{print $8}' | xargs -I path echo path
-
name: docker login
env:
DOCKER_ACCOUNT: ${{ secrets.DOCKER_ACCOUNT }}
DOCKER_ACCOUNT_TOKEN: ${{ secrets.DOCKER_ACCOUNT_TOKEN }}
run: |
echo "$DOCKER_ACCOUNT_TOKEN" | docker login -u "$DOCKER_ACCOUNT" --password-stdin
-
name: build base docker image
run: |
docker buildx build \
--platform linux/amd64 \
${{ github.workspace }}/dockerfiles -t "$DOCKER_ACCOUNT/csapp:base" --push
env:
DOCKER_ACCOUNT: ${{ secrets.DOCKER_ACCOUNT }}
-
name: build docker image
run: |
ls -d ${{ github.workspace }}/dockerfiles/*/ | awk -F '/' '{print $8}' | xargs -I path docker buildx build \
--platform linux/amd64 \
${{ github.workspace }}/dockerfiles/path -t "$DOCKER_ACCOUNT/csapp:path" --push
env:
DOCKER_ACCOUNT: ${{ secrets.DOCKER_ACCOUNT }}