Closed feoh closed 4 years ago
I got it to work with this Dockerfile. I can generate a pull request if anyone likes. I won't do it un-asked since it's a bit of a departure from what's already there.
FROM python:3-alpine
# Metadata
LABEL \
app.name="Contextualise" \
app.description="A simple and flexible tool particularly suited for organising information-heavy projects and activities consisting of unstructured and widely diverse data and information resources" \
app.license="MIT License" \
app.license.url="https://github.com/brettkromkamp/contextualise/blob/master/LICENSE" \
app.repo.url="https://github.com/brettkromkamp/contextualise" \
app.authors="Brett Kromkamp <@brettkromkamp>"
RUN apk update \
&& apk add gcc musl-dev python3-dev py3-setuptools libffi libffi-dev openssl-dev git postgresql-dev \
&& pip3 install poetry \
&& pip3 install --no-build-isolation pendulum==2.1.0
# Fetch just the dependencies, caches on the contents of requirements.txt
WORKDIR /usr/src/app
COPY ./requirements.txt ./
RUN pip install --user git+https://github.com/brettkromkamp/topic-db.git \
&& pip install --user -r requirements.txt
# Copy in the rest of the project and dependencies
COPY . .
RUN test -f settings.ini || cp settings-docker-sample.ini settings.ini
# Config for python and the app
ENV \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
FLASK_APP=contextualise \
FLASK_ENV=production \
PATH=$PATH:/root/.local/bin
# Execute via gunicorn by default
CMD ["gunicorn", "-b", "0.0.0.0:5000", "contextualise.wsgi:app"]
EXPOSE 5000
@feoh Thanks for reporting the issue and providing a potential fix! My knowledge of Docker is limited hence I am unsure how to proceed with your suggested fix. Ideally, those that have contributed Docker support to Contextualise weigh in :) @machawk1 @epilys @stratosgear @Nekroze
@ibnesayeed has some Docker expertise, so it would be helpful for him to have a quick look at the Dockerfile for wellformedness and adherence to contemporary good practice.
I don't see any issues in changing the base image to alpine
as it may reduce the image size as well, but test building the image and the runtime properly before going for that change.
Alternatively, use build args to customize the base image and leave the default value as it is for now. Those who want to change the base image to alpine
can create a custom image that has the additional apk update...
layer in it then use that image as the base by providing a build arg.
try doing pip install setuptools
then the rest of your commands. There's likely to be a wheel available for setuptools, and you should be able to install without a problem.
Honestly it's weird that pip
is available, but the de-facto packaging module setuptools
is not available.
I don't understand enough about the alternative solutions people are suggesting to implement them, and I have something that works and left a crumb trail for anyone who just needs a quick fix to get this running on a pi, so I'll yield to your greater expertise and close this :)
@feoh Thank you. I really do appreciate your contribution to Contextualise.
Hi there when I try to deploy contextualize on Ubuntu server 20.04 on my raspberry pi 4 I get:
I see a proposed work-around here but I haven't yet managed to rejigger the FROM clause in the Dockerfile to make the fix work yet so I thought I'd also mention it here :)