-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (35 loc) · 1.27 KB
/
dockerpublish.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
name: Docker
on:
push:
branches:
- main
env:
IMAGE_NAME: toolbox
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
run:
docker buildx build --platform linux/arm64,linux/amd64 -t "$IMAGE_NAME" .
- name: Log into github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image to github registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker tag $IMAGE_NAME $IMAGE_ID:${{ github.sha }}
docker push $IMAGE_ID:latest
docker push $IMAGE_ID:${{ github.sha }}
- name: Log into docker hub registry
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u apexskier --password-stdin
- name: Push image to docker hub registry
run: |
IMAGE_ID=apexskier/$IMAGE_NAME
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker tag $IMAGE_NAME $IMAGE_ID:${{ github.sha }}
docker push $IMAGE_ID:latest
docker push $IMAGE_ID:${{ github.sha }}