websoft9/docker/apphub/Dockerfile

67 lines
2.3 KiB
Docker
Raw Normal View History

2023-10-27 03:58:46 +00:00
# modify time: 2023102712, you can modify here to trigger Docker Build action
2023-10-18 08:58:47 +00:00
2023-09-19 06:32:20 +00:00
FROM python:3.10-bullseye AS buildstage
2023-02-21 06:21:53 +00:00
LABEL maintainer="Websoft9<help@websoft9.com>"
2023-10-24 08:20:29 +00:00
LABEL version="0.0.6"
2023-03-24 07:32:38 +00:00
2023-09-28 00:49:38 +00:00
ENV LIBRARY_VERSION=v0.5.8
2023-10-24 06:47:39 +00:00
ENV MEDIA_VERSION=0.0.3
2023-10-24 07:41:02 +00:00
ENV websoft9_repo="https://github.com/Websoft9/websoft9"
ENV docker_library_repo="https://github.com/Websoft9/docker-library"
ENV media_repo="https://github.com/Websoft9/media"
2023-09-18 09:13:15 +00:00
2023-10-24 06:47:39 +00:00
# Prepare source files
2023-10-24 07:41:02 +00:00
RUN wget $docker_library_repo/archive/refs/tags/$LIBRARY_VERSION.zip -O ./library.zip && \
2023-09-19 04:54:20 +00:00
unzip library.zip && \
2023-10-24 07:16:42 +00:00
mv docker-library-* w9library && \
rm -rf w9library/.github && \
2023-10-24 06:47:39 +00:00
2023-10-24 07:41:02 +00:00
wget $media_repo/archive/refs/tags/$MEDIA_VERSION.zip -O ./media.zip && \
2023-10-24 06:47:39 +00:00
unzip media.zip && \
2023-10-24 07:16:42 +00:00
mv media-* w9media && \
rm -rf w9media/.github && \
2023-10-24 06:47:39 +00:00
2023-10-08 07:56:13 +00:00
# Prepare Media and master data from Contentful
git clone --depth=1 https://github.com/swagger-api/swagger-ui.git && \
wget https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js && \
cp redoc.standalone.js swagger-ui/dist && \
2023-10-24 06:47:39 +00:00
2023-10-24 07:41:02 +00:00
git clone --depth=1 $websoft9_repo
2023-09-19 06:32:20 +00:00
2023-09-23 06:28:03 +00:00
FROM python:3.10-slim-bullseye
2023-09-19 06:32:20 +00:00
WORKDIR /websoft9
2023-10-24 07:16:42 +00:00
COPY --from=buildstage /w9media ./media
COPY --from=buildstage /w9library ./library
2023-10-11 09:19:38 +00:00
COPY --from=buildstage /websoft9/apphub ./apphub
2023-10-08 07:56:13 +00:00
COPY --from=buildstage /swagger-ui/dist ./apphub/swagger-ui
2023-10-26 09:35:44 +00:00
COPY --from=buildstage /websoft9/apphub/src/config ./config
2023-10-27 02:41:24 +00:00
COPY --from=buildstage /websoft9/docker/apphub/script ./script
2023-09-19 06:32:20 +00:00
2023-10-27 02:41:24 +00:00
RUN apt update && apt install curl git jq cron iproute2 supervisor -y --no-install-recommends
2023-04-06 05:07:21 +00:00
2023-10-20 03:46:10 +00:00
RUN pip install --no-cache-dir --upgrade -r apphub/requirements.txt
2023-10-12 08:43:15 +00:00
RUN pip install -e ./apphub
2023-09-18 09:13:15 +00:00
# supervisor
2023-09-20 03:23:21 +00:00
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chmod +r /etc/supervisor/conf.d/supervisord.conf
2023-10-27 02:41:24 +00:00
# cron
COPY config/cron /etc/cron.d/cron
2023-10-27 02:53:48 +00:00
RUN echo "" >> /etc/cron.d/cron
2023-10-27 02:41:24 +00:00
RUN crontab /etc/cron.d/cron
# chmod for all .sh script
RUN find /websoft9/script -name "*.sh" -exec chmod +x {} \;
2023-09-18 09:13:15 +00:00
2023-09-27 09:03:01 +00:00
VOLUME /websoft9/apphub/logs
2023-10-10 00:27:39 +00:00
VOLUME /websoft9/apphub/src/config
2023-09-18 09:13:15 +00:00
2023-09-19 04:54:20 +00:00
# Clean cache and install files
2023-09-20 03:55:22 +00:00
RUN rm -rf apphub/docs apphub/tests library.zip plugin-appstore && \
apt clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc /usr/share/doc-base
2023-02-21 06:21:53 +00:00
2023-09-18 09:13:15 +00:00
EXPOSE 8080
2023-10-27 02:41:24 +00:00
ENTRYPOINT ["/websoft9/script/entrypoint.sh"]