Sign inSign up

cellerich/env-python-3-8-pandas

By cellerich

•Updated over 5 years ago

Image
0

192

cellerich/env-python-3-8-pandas repository overview

⁠AppWrite function environment for Python functions with Pandas preinstalled

Appwrite⁠ is a self-hosted solution that provides developers with a set of easy-to-use and integrate REST APIs to manage their core backend needs.

Since version 0.7.x Appwrite Functions⁠ allow you to extend and customize your Appwrite server functionality by executing your custom code. The custom code is executed in a docker container within the Appwrite server. Appwrite has containers for several programming languages.

However the Python container is based on python:3.8-alpine and is missing the Pandas⁠ library which is used for data analysis and manipulation. Pandas is not easily installed on top of a Alpine Linux container and there is a discussion about this on Stackoverflow⁠.

To have a version of a Appwrite-Python container including Pandas I created this image with the following dockerfile:

FROM python:3.8-alpine

LABEL maintainer="[email protected]"

RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk add py3-pandas@community
ENV PYTHONPATH="/usr/lib/python3.8/site-packages"

RUN apk add tar

RUN mkdir /usr/local/src

WORKDIR /usr/local/src/

ENV PYTHONPATH "${PYTHONPATH}:/usr/local/src/.appwrite"

The build command is:

# dockerfile in current directory
docker buildx build \
    --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le \
    -t cellerich/env-python-3-8-pandas:1.0.0 \
    . \
    --push

To make this work (as a temporary workaround) in your Appwrite installation you have to change a line in environments.php (see the source code on Github⁠)

  • attach to your appwrite-worker-functions container
  • change appwrite/env-python-3.8:1.0.0 to cellerich/env-python:3-8-pandas:1.0.0:
  • restart the appwrite-worker-functions container
    'python-3.8-pandas' => [
        'name' => 'Python Pandas',
        'version' => '3.8',
        'base' => 'python:3.8-alpine',
        'image' => 'cellerich/env-python:3-8-pandas:1.0.0',
        'build' => '/usr/src/code/docker/environments/python-3.8',
        'logo' => 'python.png',
        'supports' => [System::X86, System::PPC, System::ARM],
    ],

Tag summary

Content type

Image

Digest

Size

60.2 MB

Last updated

over 5 years ago

docker pull cellerich/env-python-3-8-pandas:1.0.0