From 39bb6f0a02b09431d6d05b062952346630cfb254 Mon Sep 17 00:00:00 2001 From: AnduinXue Date: Tue, 12 Mar 2024 18:33:19 +0000 Subject: [PATCH] Add docker support. --- .github/templates/readme_template.md | 1 + .gitlab-ci.yml | 8 ++++++++ Dockerfile | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 Dockerfile diff --git a/.github/templates/readme_template.md b/.github/templates/readme_template.md index 8397f6c1..11ba072e 100644 --- a/.github/templates/readme_template.md +++ b/.github/templates/readme_template.md @@ -5,6 +5,7 @@ [![GitHub contributors](https://img.shields.io/github/contributors/Anduin2017/HowToCook)](https://github.com/Anduin2017/HowToCook/graphs/contributors) [![npm](https://img.shields.io/npm/v/how-to-cook)](https://www.npmjs.com/package/how-to-cook) ![Man hours](https://manhours.aiursoft.cn/r/github.com/anduin2017/howtocook.svg) +[![Docker](https://img.shields.io/badge/docker-latest-blue?logo=docker)](https://hub.aiursoft.cn/#!/taglist/anduin/howtocook) 最近在家隔离,出不了门。只能宅在家做饭了。作为程序员,我偶尔在网上找找菜谱和做法。但是这些菜谱往往写法千奇百怪,经常中间莫名出来一些材料。对于习惯了形式语言的程序员来说极其不友好。 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..26e6f370 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,8 @@ +stages: + - deploy + +deploy_docker: + stage: deploy + script: + - docker build . -t hub.aiursoft.cn/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:latest + - docker push hub.aiursoft.cn/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..7add5029 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# ============================ +# Prepare Node Environment +FROM hub.aiursoft.cn/node:21-alpine as node-env +WORKDIR /app +COPY . . +RUN node ./.github/readme-generate.js + +# ============================ +# Prepare Build Environment +FROM hub.aiursoft.cn/python:3.11 as python-env +WORKDIR /app +COPY --from=node-env /app . +RUN pip install -r requirements.txt +RUN mkdocs build --strict + +# ============================ +# Prepare Runtime Environment +FROM hub.aiursoft.cn/aiursoft/static +COPY --from=python-env /app/site /data