websoft9/docker/apphub/Dockerfile

65 lines
2.4 KiB
Docker
Raw Normal View History

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