Skip to content

Commit 1f8187b

Browse files
committed
chore: Update Dockerfile to use GitHub Container Registry for image build and push
1 parent a69bd83 commit 1f8187b

File tree

7 files changed

+36
-428
lines changed

7 files changed

+36
-428
lines changed

.github/templates/readme_template.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,25 @@
55
[![GitHub contributors](https://img.shields.io/github/contributors/Anduin2017/HowToCook)](https://github.com/Anduin2017/HowToCook/graphs/contributors)
66
[![npm](https://img.shields.io/npm/v/how-to-cook)](https://www.npmjs.com/package/how-to-cook)
77
![Man hours](https://manhours.aiursoft.cn/r/github.com/anduin2017/howtocook.svg)
8-
[![Docker](https://img.shields.io/badge/docker-latest-blue?logo=docker)](https://hub.docker.com/r/anduin2019/howtocook)
8+
[![Docker](https://img.shields.io/badge/docker-latest-blue?logo=docker)](https://github.com/Anduin2017/HowToCook/pkgs/container/how-to-cook)
99

1010
最近在家隔离,出不了门。只能宅在家做饭了。作为程序员,我偶尔在网上找找菜谱和做法。但是这些菜谱往往写法千奇百怪,经常中间莫名出来一些材料。对于习惯了形式语言的程序员来说极其不友好。
1111

1212
所以,我计划自己搜寻菜谱并结合实际做菜的经验,准备用更清晰精准的描述来整理常见菜的做法,以方便程序员在家做饭。
1313

1414
同样,我希望它是一个由社区驱动和维护的开源项目,使更多人能够一起做一个有趣的仓库。所以非常欢迎大家贡献它~
1515

16+
## 本地部署
17+
18+
如果需要在本地阅读这个仓库,可以在安装 Docker 后运行以下命令:
19+
20+
```bash
21+
docker pull ghcr.io/anduin2017/how-to-cook:latest
22+
docker run -d -p 5000:5000 ghcr.io/anduin2017/how-to-cook:latest
23+
```
24+
25+
下载 PDF 版本,可以在浏览器中访问 [/document.pdf](https://cook.aiursoft.cn/document.pdf)
26+
1627
## 如何贡献
1728

1829
针对发现的问题,直接修改并提交 Pull request 即可。

.github/workflows/build.yml

+2-15
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ jobs:
1717
with:
1818
node-version: '16'
1919
cache: 'npm'
20-
# Generate Readme, mkdocs.
21-
- run: node ./.github/readme-generate.js
22-
# Lint issues first. (Without node_modules)
2320
- run: npm install
21+
- run: npm run build
2422
- run: npm run lint
2523
# Save files.
2624
- uses: stefanzweifel/git-auto-commit-action@v4
@@ -31,17 +29,6 @@ jobs:
3129
commit_user_name: github-actions[bot]
3230
commit_user_email: github-actions[bot]@users.noreply.github.com
3331
commit_author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
34-
# Build docs
35-
36-
# Deprecated. Now use docker.
37-
# - run: echo cook.aiurs.co > CNAME
38-
# - run: mkdir docs && echo cook.aiurs.co > docs/CNAME
39-
# - uses: mhausenblas/mkdocs-deploy-gh-pages@master
40-
# env:
41-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
# CUSTOM_DOMAIN: cook.aiurs.co
43-
# CONFIG_FILE: mkdocs.yml
44-
# REQUIREMENTS: requirements.txt
4532

4633
# Use docker to build current directory ./Dockfile
4734
- name: Login to GitHub Container Registry
@@ -51,7 +38,7 @@ jobs:
5138
username: ${{ github.actor }}
5239
password: ${{ secrets.GITHUB_TOKEN }}
5340

54-
- name: Build the hello-world Docker image
41+
- name: Build and push the Docker image
5542
run: |
5643
docker build . --tag ghcr.io/anduin2017/how-to-cook:latest
5744
docker push ghcr.io/anduin2017/how-to-cook:latest

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ node_modules/
55
site/
66

77
.idea
8-
*.iml
8+
*.iml
9+
mkdocs.yml

Dockerfile

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# ============================
2-
# Prepare Node Environment
3-
FROM hub.aiursoft.cn/node:21-alpine as node-env
2+
# Prepare lint Environment
3+
FROM hub.aiursoft.cn/node:21-alpine as lint-env
44
WORKDIR /app
55
COPY . .
6-
RUN node ./.github/readme-generate.js
6+
RUN npm install
7+
RUN npm run build
8+
RUN npm run lint
79

810
# ============================
911
# Prepare Build Environment
1012
FROM hub.aiursoft.cn/python:3.11 as python-env
1113
WORKDIR /app
12-
COPY --from=node-env /app .
13-
RUN pip install -r requirements.txt && rm node_modules -rf
14+
COPY --from=lint-env /app .
1415
RUN apt-get update && apt-get install -y weasyprint fonts-noto-cjk wget unzip
16+
RUN rm node_modules -rf && pip install -r requirements.txt
1517
RUN wget https://gitlab.aiursoft.cn/anduin/anduinos/-/raw/master/Config/fonts.conf -O /etc/fonts/local.conf
1618
RUN wget -P /tmp https://gitlab.aiursoft.cn/anduin/anduinos/-/raw/master/Assets/fonts.zip
1719
RUN unzip -o /tmp/fonts.zip -d /usr/share/fonts/

README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,25 @@
55
[![GitHub contributors](https://img.shields.io/github/contributors/Anduin2017/HowToCook)](https://github.com/Anduin2017/HowToCook/graphs/contributors)
66
[![npm](https://img.shields.io/npm/v/how-to-cook)](https://www.npmjs.com/package/how-to-cook)
77
![Man hours](https://manhours.aiursoft.cn/r/github.com/anduin2017/howtocook.svg)
8-
[![Docker](https://img.shields.io/badge/docker-latest-blue?logo=docker)](https://hub.docker.com/r/anduin2019/howtocook)
8+
[![Docker](https://img.shields.io/badge/docker-latest-blue?logo=docker)](https://github.com/Anduin2017/HowToCook/pkgs/container/how-to-cook)
99

1010
最近在家隔离,出不了门。只能宅在家做饭了。作为程序员,我偶尔在网上找找菜谱和做法。但是这些菜谱往往写法千奇百怪,经常中间莫名出来一些材料。对于习惯了形式语言的程序员来说极其不友好。
1111

1212
所以,我计划自己搜寻菜谱并结合实际做菜的经验,准备用更清晰精准的描述来整理常见菜的做法,以方便程序员在家做饭。
1313

1414
同样,我希望它是一个由社区驱动和维护的开源项目,使更多人能够一起做一个有趣的仓库。所以非常欢迎大家贡献它~
1515

16+
## 本地部署
17+
18+
如果需要在本地阅读这个仓库,可以在安装 Docker 后运行以下命令:
19+
20+
```bash
21+
docker pull ghcr.io/anduin2017/how-to-cook:latest
22+
docker run -d -p 5000:5000 ghcr.io/anduin2017/how-to-cook:latest
23+
```
24+
25+
下载 PDF 版本,可以在浏览器中访问 [/document.pdf](https://cook.aiursoft.cn/document.pdf)
26+
1627
## 如何贡献
1728

1829
针对发现的问题,直接修改并提交 Pull request 即可。

0 commit comments

Comments
 (0)