-
Notifications
You must be signed in to change notification settings - Fork 5
51 lines (43 loc) · 1.31 KB
/
build_image_pyenv_python.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
name: Build and push Docker image 'pyenv_python'
on:
push:
branches:
- master
paths:
- 'pyenv_python/**'
- '.github/workflows/build_image_pyenv_python.yml'
pull_request:
paths:
- 'pyenv_python/**'
- '.github/workflows/build_image_pyenv_python.yml'
env:
IMAGE_DIR: ./pyenv_python
IMAGE_NAME: ghcr.io/${{ github.repository }}/pyenv_python
IMAGE_TAG: v1
IMAGE_ARCHS: linux/amd64,linux/arm,linux/arm64
jobs:
create-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GHRC
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push image
uses: docker/build-push-action@v2
with:
context: ${{env.IMAGE_DIR}}
platforms: ${{env.IMAGE_ARCHS}}
tags: ${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}}
# Push package to registry only when merged to master
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha
cache-to: type=gha,mode=max