Hi I am trying to run postgresql in alpine in docker with SQLAlchemy and flask but anytime I run my app I get this error ImportError: Error loading shared library libpq.so.5: No such file or directory (needed by /usr/local/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-x86_64-linux-gnu.so)
I have combed stack overflow for a solution but everyone one them seems to tell me to install
psycopg2 which I have done already
FROM python:3.8.1-alpine3.10 AS build
# ENV PYTHONUNBUFFERED 1
WORKDIR /usr/src/app/restful
COPY requirements.txt /usr/src/app/restful
RUN python -m pip install --upgrade pip
RUN apk update && apk upgrade
RUN apk add libffi-dev
#installing dependencies
# dependencies for libpq postgresql-libs postgresql-dev *remove if not
RUN apk add --no-cache --virtual .build-deps gcc libc-dev py-cryptography libpq postgresql-libs postgresql-dev python3-dev musl-dev make openssl-dev gcc
RUN apk update && apk add --no-cache ca-certificates \
&& update-ca-certificates 2>/dev/null || true
RUN apk add build-base python-dev py-pip jpeg-dev zlib-dev
ENV LIBRARY_PATH=/lib:/usr/lib
WORKDIR /usr/src/app/restful
COPY requirements.txt /usr/src/app/restful
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN python -m pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install gevent
FROM python:3.8.1-alpine3.10
COPY --from=build /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/
RUN mkdir -p /usr/src/app/restful
RUN set -ex && apk --no-cache add sudo
RUN apk --no-cache --update add libffi libressl
RUN apk update && apk add --no-cache supervisor
RUN pip install psycopg2-binary
RUN apk add --no-cache libpq
after the second FROM without reinstallingpostgresql-libs gcc libc-dev
. I'm using arm32v7/python:3.8-alpine3.12 – Bosom