update CI

This commit is contained in:
Attilio Greco 2022-12-15 14:42:50 +01:00
parent 4cbc716669
commit 41c6187d83
No known key found for this signature in database
GPG Key ID: FC1D47921C8F19CC
3 changed files with 68 additions and 20 deletions

View File

@ -7,36 +7,69 @@ on:
types: [published, created, edited]
pull_request:
jobs:
push:
build_base_image:
strategy:
matrix:
python: [3.8, 3.9, 3.10.6, 3.11.1]
alpine: ["3.15", "3.16"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/web-base
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{row}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Web-base Meta
id: meta-web-base
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/web-base
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Build and push
uses: docker/build-push-action@v2
with:
build-args: |
PYTHON_VERSION=${{ matrix.python }}
ALPINE_VERSION=${{ matrix.alpine }}
context: .
platforms: linux/amd64,linux/arm64
file: ./Docker/Dockerfile.base
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ matrix.python }}-alpine${{ matrix.alpine }}
# - name: Poetry Meta
# id: meta-web-poetry
# uses: docker/metadata-action@v3
# with:
# images: |
# ghcr.io/${{ github.repository_owner }}/web-base
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# with:
# platforms: linux/amd64,linux/arm64
# build-args: |
# PYTHON_VERSION=${{ matrix.python }}
# ALPINE_VERSION=${{ matrix.alpine }}
#
# - name: Build and push Poetry
# uses: docker/build-push-action@v2
# with:
# context: .
# file: ./Docker/Dockerfile.poetry
# platforms: linux/amd64,linux/arm64
# push: true
# tags: ${{ matrix.python }}-alpine${{ matrix.alpine }}

View File

@ -1,4 +1,7 @@
FROM python:3.10.6-alpine3.16 AS build-image
ARG PYTHON_VERSION
ARG ALPINE_VERSION
FROM python:$PYTHON_VERSION-alpine$ALPINE_VERSION AS build-image
RUN apk update \
&& apk add --no-cache \
@ -6,6 +9,6 @@ RUN apk update \
make autoconf libtool postgresql-dev build-base g++ gcc \
unixodbc-dev freetds-dev libffi libffi-dev czmq-dev libxml2-dev \
libxslt-dev automake cmake git openssl-dev ffmpeg libwebp-dev \
cargo poetry
cargo
CMD ["/bin/bash"]

12
Docker/Dockerfile.poetry Normal file
View File

@ -0,0 +1,12 @@
ARG PYTHON_VERSION
ARG ALPINE_VERSION
FROM python:$PYTHON_VERSION-alpine$ALPINE_VERSION AS poetry
ARG install_dev
WORKDIR /app
ENV POETRY_HOME=/opt/poetry
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV PATH="$POETRY_HOME/bin:$PATH"
RUN python -c 'from urllib.request import urlopen; print(urlopen("https://install.python-poetry.org").read().decode())' | python -
CMD ["/bin/bash"]