-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (41 loc) · 1.75 KB
/
consumer-docker.yaml
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
name: Consumer CI
on:
push:
branches: [main, dev, feature/consumer]
pull_request:
branches: [main, dev]
env:
IMAGE_NAME: tsmc-hackathon-2024-consumer
DOCKER_FILE_PATH: ./backend-mock # '.' for root directory
DOCKER_FILE_NAME: Dockerfile # change to your Dockerfile name
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up containerd
uses: crazy-max/ghaction-setup-containerd@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: ${{ env.DOCKER_FILE_PATH }}
# file: ${{ env.DOCKER_FILE_NAME }}
platforms: linux/amd64,linux/arm64
tags: docker.io/${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest
outputs: type=oci,dest=/tmp/image.tar
- name: Import image in containerd
run: |
sudo ctr i import --base-name docker.io/${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest --digests --all-platforms /tmp/image.tar
- name: Push image to containerd
run: |
sudo ctr i push --user "${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}" docker.io/${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest