websoft9/docker/apphub/Dockerfile

71 lines
2.9 KiB
Docker
Raw Normal View History

2023-12-08 19:11:56 +08:00
# This file can running at actions
2023-12-15 10:05:37 +08:00
# MEDIA_VERSION and LIBRARY_VERSION will trigger its release
2025-01-21 09:28:39 +08:00
# modify time: 202501210930, you can modify here to trigger Docker Build action
2023-10-18 16:58:47 +08:00
2023-12-08 17:35:45 +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>"
2025-01-02 14:46:27 +08:00
LABEL version="0.1.9"
2023-03-24 15:32:38 +08:00
2023-10-30 14:10:56 +08:00
WORKDIR /websoft9
2024-09-03 15:19:51 +08:00
ARG MEDIA_VERSION="0.1.1"
ARG LIBRARY_VERSION="0.7.1"
2023-12-10 10:36:32 +08:00
ARG WEBSOFT9_REPO="https://github.com/Websoft9/websoft9"
2024-09-05 09:04:28 +08:00
ARG WEBSOFT9_ARTIFACT="https://artifact.websoft9.com/release/websoft9"
2023-12-10 10:36:32 +08:00
ARG LIBRARY_REPO="https://github.com/Websoft9/docker-library"
ARG SOURCE_GITHUB_PAGES="https://websoft9.github.io/websoft9"
2023-10-30 14:10:56 +08:00
2023-12-11 08:01:21 +08:00
# If you build this image on local, need download media.zip from WEBSOFT9_ARTIFACT to docker/apphub directory like below
2024-09-05 09:04:28 +08:00
# RUN curl -o media.zip https://artifact.websoft9.com/release/websoft9/plugin/media/media-latest.zip
2023-12-08 18:14:19 +08:00
COPY media.zip /websoft9
2023-11-01 10:49:53 +08:00
RUN apt update && apt install -y --no-install-recommends curl git jq cron iproute2 supervisor rsync wget unzip zip && \
2023-12-08 18:23:14 +08:00
# download docker-library
2023-12-10 10:36:32 +08:00
git clone --depth=1 $LIBRARY_REPO && \
2023-12-08 12:02:48 +08:00
mv docker-library w9library && \
2023-12-08 18:08:57 +08:00
rm -rf w9library/.github && \
2023-12-08 18:16:55 +08:00
ls -la && \
2023-12-08 18:27:17 +08:00
unzip media.zip && rm -rf media.zip && \
2023-12-08 18:16:55 +08:00
mv media* w9media && \
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-12-10 10:36:32 +08:00
git clone --depth=1 $WEBSOFT9_REPO ./w9source && \
2023-12-08 18:16:55 +08:00
cp -r ./w9media ./media && \
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 && \
2023-12-10 10:36:32 +08:00
curl -o ./script/update_zip.sh $SOURCE_GITHUB_PAGES/scripts/update_zip.sh && \
2024-12-23 15:05:39 +08:00
curl -o /websoft9/version.json $SOURCE_GITHUB_PAGES/version.json && \
2023-12-08 18:16:55 +08:00
pip install --no-cache-dir --upgrade -r apphub/requirements.txt && \
pip install -e ./apphub && \
# Clean cache and install files
rm -rf apphub/docs apphub/tests library.zip media.zip redoc.standalone.js swagger-ui w9library w9media w9source && \
apt clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc /usr/share/doc-base
2023-10-12 16:43:15 +08:00
2024-12-18 16:13:23 +08:00
# Create a file named migration_flag
RUN touch /websoft9/migration_flag
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
2024-10-15 11:14:00 +08:00
COPY config/logging_config.yaml /etc/supervisor/conf.d/logging_config.yaml
RUN chmod +r /etc/supervisor/conf.d/supervisord.conf /etc/supervisor/conf.d/logging_config.yaml
2023-10-27 10:41:24 +08:00
# cron
COPY config/cron /etc/cron.d/cron
2023-11-01 10:49:53 +08:00
RUN echo "" >> /etc/cron.d/cron && crontab /etc/cron.d/cron
2023-10-27 10:41:24 +08:00
# 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
EXPOSE 8080
2023-12-28 15:47:34 +08:00
EXPOSE 8081
2023-11-13 17:24:14 +08:00
ENTRYPOINT ["/websoft9/script/entrypoint.sh"]