diff --git a/docker/w9apphub/Dockerfile b/docker/w9apphub/Dockerfile index ddd17b69..e166d422 100644 --- a/docker/w9apphub/Dockerfile +++ b/docker/w9apphub/Dockerfile @@ -1,34 +1,40 @@ -# python:3.10-bullseye -# RUN apt update & apt install wget git curl unzip - -FROM python:3.10-bullseye +FROM python:3.10-bullseye AS buildstage LABEL maintainer="Websoft9" LABEL version="0.8.17" ENV LIBRARY_VERSION=v0.5.4 -WORKDIR /usr/websoft9 - # Prepare library RUN wget https://github.com/Websoft9/docker-library/archive/refs/tags/$LIBRARY_VERSION.zip -O ./library.zip && \ unzip library.zip && \ + mv docker-library-* library && \ mkdir credentials && \ echo "This folder stored the credentials of other services that apphub will connect" > credentials/readme && \ # Prepare Media and master data from Contentful git clone --depth=1 https://github.com/Websoft9/plugin-appstore && \ - mv -f plugin-appstore/data ./media + mv -f plugin-appstore/data ./media && \ + git clone --depth=1 https://github.com/Websoft9/websoft9 -# Copy source and install pip dpendencies -# Todo: add virtualenv for Python install -#COPY ../../appmanage_new ./apphub -#RUN pip install -r apphub/requirements.txt +FROM python:3.10-slim-bullseye +WORKDIR /websoft9 + +COPY --from=buildstage /media/data ./media +COPY --from=buildstage /library ./library +COPY --from=buildstage /websoft9/appmanage_new ./apphub + + +RUN mkdir credentials && \ + echo "This folder stored the credentials of other services that integrated with apphub" > credentials/readme + +RUN pip install -r apphub/requirements.txt + # supervisor RUN pip install supervisor -COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -RUN chmod +r /etc/supervisor/conf.d/supervisord.conf +COPY config/supervisord.conf /usr/local/supervisord.conf +RUN chmod +r /usr/local/supervisord.conf COPY config/entrypoint.sh /entrypoint.sh @@ -42,4 +48,4 @@ VOLUME /usr/websoft9/media RUN rm -rf apphub/docs apphub/tests library.zip plugin-appstore EXPOSE 8080 -ENTRYPOINT [/entrypoint.sh] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/w9apphub/config/entrypoint.sh b/docker/w9apphub/config/entrypoint.sh index d3d43f9a..d368741d 100644 --- a/docker/w9apphub/config/entrypoint.sh +++ b/docker/w9apphub/config/entrypoint.sh @@ -2,6 +2,6 @@ # start by supervisord -/usr/bin/supervisord +/usr/local/bin/supervisord supervisorctl start all -tail -f /dev/null +tail -f /dev/null \ No newline at end of file diff --git a/docker/w9apphub/config/supervisord.conf b/docker/w9apphub/config/supervisord.conf index da821239..c1629407 100644 --- a/docker/w9apphub/config/supervisord.conf +++ b/docker/w9apphub/config/supervisord.conf @@ -1,10 +1,12 @@ [supervisord] nodaemon=false -uvicorn app.main:app --reload --port 8080 + +[supervisorctl] + [program:apphub] -command=uvicorn main:get_app --host 0.0.0.0 --port 5000 --log-level info +command=uvicorn app.main:app --reload --host 0.0.0.0 --port 8080 --log-level info autostart=true directory=/usr/websoft9/apphub \ No newline at end of file