diff --git a/.github/workflows/images_alpy.yml b/.github/workflows/images_alpy.yml new file mode 100644 index 0000000..f62dce8 --- /dev/null +++ b/.github/workflows/images_alpy.yml @@ -0,0 +1,127 @@ +name: Publish Docker Images (Alpy) + +on: + push: + branches: [ "add-gha-docker-images" ] + workflow_dispatch: + +# fixme +env: + PROTOPLASM_PY_PKG_VERSION: "5.0.0" + GRPCIO_IMAGE_VERSION: "1.0.0" + PSYCOPG_VERSION: "3.1" + IMAGE_REGISTRY: "vayan" + +jobs: + alpy_base: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ "3.8.18", "3.9.18", "3.10.13", "3.11.8", "3.12.2" ] + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Set config variable env + run: | + ALPY_VERSION=`echo ${{ matrix.python-version }} | cut -d. -f1,2` + echo "ALPY_VERSION=$ALPY_VERSION" >> $GITHUB_ENV + echo "HASH_VERSION=${{ hashFiles('requirements.txt', 'docker/alpy/base.Dockerfile') }}" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: docker/alpy/base.Dockerfile + network: host + no-cache: true + push: true + build-args: | + PYTHON_VERSION=${{ matrix.python-version }} + tags: | + ${{ env.IMAGE_REGISTRY }}/grpcio-alpy${{ env.ALPY_VERSION }}-base:${{ env.GRPCIO_IMAGE_VERSION }}-${{ env.HASH_VERSION }} + ${{ env.IMAGE_REGISTRY }}/grpcio-alpy${{ env.ALPY_VERSION }}-base:latest + + alpy: + runs-on: ubuntu-latest + needs: [ alpy_base ] # TODO also needs protoplasm release + strategy: + matrix: + alpy-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Set config variable env + run: | + echo "IMG_FULL=${{ env.IMAGE_REGISTRY }}/protoplasm:${{ env.PROTOPLASM_PY_PKG_VERSION }}-alpy${{ matrix.alpy-version }}" >> $GITHUB_ENV + echo "HASH_VERSION=${{ hashFiles('requirements.txt', 'docker/alpy/base.Dockerfile') }}" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: docker/alpy/Dockerfile + network: host + no-cache: true + push: true + build-args: | + PACKAGE_VERSION=${{ env.PROTOPLASM_PY_PKG_VERSION }} + BASE_IMAGE=${{ env.IMAGE_REGISTRY }}/grpcio-alpy${{ matrix.alpy-version }}-base:${{ env.GRPCIO_IMAGE_VERSION }}-${{ env.HASH_VERSION }} + tags: | + ${{ env.IMG_FULL }} + ${{ env.IMAGE_REGISTRY }}/protoplasm:latest-alpy${{ env.ALPY_VERSION }} + + alpy_psycopg: + runs-on: ubuntu-latest + needs: [ alpy ] + strategy: + matrix: + alpy-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Set config variable env + run: | + echo "IMG_FULL=${{ env.IMAGE_REGISTRY }}/protoplasm:${{ env.PROTOPLASM_PY_PKG_VERSION }}-alpy${{ matrix.alpy-version }}-psycopg${{ env.PSYCOPG_VERSION }}" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: docker/alpy/psycopg.Dockerfile + network: host + no-cache: true + push: true + build-args: | + BASE_IMAGE=${{ env.IMAGE_REGISTRY }}/protoplasm:${{ env.PROTOPLASM_PY_PKG_VERSION }}-alpy${{ matrix.alpy-version }} + PSYCOPG_VERSION=${{ env.PSYCOPG_VERSION }} + tags: | + ${{ env.IMG_FULL }} + ${{ env.IMAGE_REGISTRY }}/protoplasm:latest-alpy${{ matrix.alpy-version }}-psycopg${{ env.PROTOPLASM_PY_PKG_VERSION }} + ${{ env.IMAGE_REGISTRY }}/protoplasm:latest-alpy${{ matrix.alpy-version }}-psycopg diff --git a/.github/workflows/images_depy.yml b/.github/workflows/images_depy.yml new file mode 100644 index 0000000..10d13bf --- /dev/null +++ b/.github/workflows/images_depy.yml @@ -0,0 +1,91 @@ +name: Publish Docker Images (Depy) + +on: + push: + branches: [ "add-gha-docker-images" ] + workflow_dispatch: + +# fixme +env: + PROTOPLASM_PY_PKG_VERSION: "5.0.0" + GRPCIO_IMAGE_VERSION: "1.0.0" + PSYCOPG_VERSION: "3.1" + IMAGE_REGISTRY: "vayan" + +jobs: + depy: + # TODO needs protoplasm release + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ "3.8.18", "3.9.18", "3.10.13", "3.11.8", "3.12.2"] + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Set config variable env + run: | + DEPY_VERSION=`echo ${{ matrix.python-version }} | cut -d. -f1,2` + echp "DEPY_VERSION=${DEPY_VERSION}" >> $GITHUB_ENV + echo "IMG_FULL=${{ env.IMAGE_REGISTRY }}/protoplasm:${{ env.PROTOPLASM_PY_PKG_VERSION }}-depy${DEPY_VERSION}" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: docker/depy/Dockerfile + network: host + no-cache: true + push: true + build-args: | + PYTHON_VERSION=${{ matrix.python-version }} + PACKAGE_VERSION=${{ env.PROTOPLASM_PY_PKG_VERSION }} + tags: | + ${{ env.IMG_FULL }} + ${{ env.IMAGE_REGISTRY }}/protoplasm:latest-depy${{ env.DEPY_VERSION }} + + depy_psycopg: + runs-on: ubuntu-latest + needs: [ depy ] + strategy: + matrix: + depy-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Set config variable env + run: | + echo "IMG_FULL=${{ env.IMAGE_REGISTRY }}/protoplasm:${{ env.PROTOPLASM_PY_PKG_VERSION }}-depy${{ matrix.depy-version }}-pyodbc${{ env.PSYCOPG_VERSION }}" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: docker/depy/pyodbc.Dockerfile + network: host + no-cache: true + push: true + build-args: | + BASE_IMAGE=${{ env.IMAGE_REGISTRY }}/protoplasm:${{ env.PROTOPLASM_PY_PKG_VERSION }}-depy${{ matrix.depy-version }} + PYODBC_VERSION=${{ env.PSYCOPG_VERSION }} + tags: | + ${{ env.IMG_FULL }} + ${{ env.IMAGE_REGISTRY }}/protoplasm:latest-depy${{ matrix.depy-version }}-pyodbc${{ env.PSYCOPG_VERSION }} + ${{ env.IMAGE_REGISTRY }}/protoplasm:latest-depy${{ matrix.depy-version }}-pyodbc \ No newline at end of file diff --git a/docker/alpy/Dockerfile b/docker/alpy/Dockerfile new file mode 100644 index 0000000..e379b73 --- /dev/null +++ b/docker/alpy/Dockerfile @@ -0,0 +1,21 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +ARG PACKAGE_VERSION +ENV PACKAGE_VERSION=${PACKAGE_VERSION} + +RUN echo Package Version is $PACKAGE_VERSION \ + && echo Package Version in loops is ${PACKAGE_VERSION} \ + && echo "Package Version in loops and string is ${PACKAGE_VERSION}" \ + && apk add --update --no-cache --virtual .build-deps \ + gcc \ + linux-headers \ + make \ + musl-dev \ + python3-dev \ + libffi-dev \ + g++ \ + && python -m pip install --upgrade pip \ + && python -m pip install --upgrade cryptography \ + && python -m pip install --upgrade "protoplasm==${PACKAGE_VERSION}.*" \ + && apk del .build-deps diff --git a/docker/alpy/base.Dockerfile b/docker/alpy/base.Dockerfile new file mode 100644 index 0000000..debcffc --- /dev/null +++ b/docker/alpy/base.Dockerfile @@ -0,0 +1,19 @@ +ARG PYTHON_VERSION +FROM python:${PYTHON_VERSION}-alpine3.19 + +COPY requirements.txt . + +RUN apk add --update --no-cache --virtual .build-deps \ + gcc \ + linux-headers \ + make \ + musl-dev \ + python3-dev \ + libffi-dev \ + g++ \ + && python -m pip install --upgrade pip \ + && python -m pip install --upgrade cryptography \ + && python -m pip install --upgrade -r requirements.txt \ + && apk del .build-deps \ + && rm -f requirements.txt \ + && apk add --update --no-cache libstdc++ diff --git a/docker/alpy/psycopg.Dockerfile b/docker/alpy/psycopg.Dockerfile new file mode 100644 index 0000000..1768d81 --- /dev/null +++ b/docker/alpy/psycopg.Dockerfile @@ -0,0 +1,19 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +ARG PSYCOPG_VERSION +ENV PSYCOPG_VERSION=${PSYCOPG_VERSION} + +RUN apk add --update --no-cache --virtual .build-deps \ + gcc \ + linux-headers \ + make \ + musl-dev \ + python3-dev \ + libffi-dev \ + g++ \ + postgresql-dev \ + && python -m pip install --upgrade pip \ + && python -m pip install --upgrade "psycopg[binary]==${PSYCOPG_VERSION}.*" \ + && apk del .build-deps \ + && apk add --update --no-cache libpq diff --git a/docker/depy/Dockerfile b/docker/depy/Dockerfile new file mode 100644 index 0000000..ab50b9d --- /dev/null +++ b/docker/depy/Dockerfile @@ -0,0 +1,14 @@ +ARG PYTHON_VERSION +FROM python:${PYTHON_VERSION}-slim-bookworm + +ARG PACKAGE_VERSION +ENV PACKAGE_VERSION=${PACKAGE_VERSION} + +# Stuff and libraries +RUN apt-get update \ + && apt-get install -y \ + apt-transport-https \ + python3-dev \ + --no-install-recommends \ + && python -m pip install --upgrade pip \ + && python -m pip install --upgrade "protoplasm==${PACKAGE_VERSION}.*" diff --git a/docker/depy/pyodbc.Dockerfile b/docker/depy/pyodbc.Dockerfile new file mode 100644 index 0000000..01e6a4b --- /dev/null +++ b/docker/depy/pyodbc.Dockerfile @@ -0,0 +1,29 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +ARG PYODBC_VERSION +ENV PYODBC_VERSION=${PYODBC_VERSION} + +RUN apt-get update \ + && ACCEPT_EULA=Y apt-get install -y curl \ + gnupg \ + && apt-get clean \ + && apt-get autoremove --purge + +# Get some keys that seems proper +RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg + +# Download appropriate package for the OS version - Debian 12 +RUN curl https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list + +# Install the drivers, tools, Dev libraries & necessary locales +RUN apt-get update \ + && ACCEPT_EULA=Y apt-get install -y msodbcsql17 \ + unixodbc-dev \ + python3-dev \ + g++ \ + && python -m pip install "pyodbc==${PYODBC_VERSION}.*" \ + && apt-get purge -y --auto-remove unixodbc-dev \ + g++ \ + && apt-get -y clean \ + && apt-get autoremove -y --purge \