Update python requirements and create slim docker image #421
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build scpca-tools images | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: alexslemonade/scpcatools | |
jobs: | |
build_and_push_slim: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker login | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build slim image | |
uses: docker/build-push-action@v5 | |
with: | |
context: "{{defaultContext}}:docker" | |
file: scpcatools_slim.Dockerfile | |
tags: scpcatools-slim | |
outputs: type=docker,dest=/tmp/scpcatools-slim.tar # output for sharing | |
cache-from: type=gha | |
cache-to: type=gha | |
- name: Upload slim image artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: slim-image | |
path: /tmp/slim.tar | |
build_and_push_matrix: | |
runs-on: ubuntu-22.04 | |
needs: build_and_push_slim | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- dockerfile: Dockerfile | |
suffix: "" | |
- dockerfile: scpcatools_slim.Dockerfile | |
suffix: "-slim" | |
steps: | |
- name: Download slim image artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: slim-image | |
path: /tmp | |
- name: Load slim image | |
run: docker load --input /tmp/scpcatools-slim.tar | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker login | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: suffix=${{ matrix.suffix }},onlatest=true | |
tags: | | |
type=semver,pattern={{raw}} | |
type=edge,branch=main | |
- name: Build and push image | |
uses: docker/build-push-action@v5 | |
with: | |
context: "{{defaultContext}}:docker" | |
file: ${{ matrix.dockerfile }} | |
push: ${{ github.event_name == 'push' }} | |
outputs: type=docker,dest=/tmp/slim.tar # output for sharing | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha |