chore: Update Dockerfile to use GitHub Container Registry for image build and push

This commit is contained in:
Anduin
2024-06-03 12:37:05 +00:00
parent a69bd83e14
commit 1f8187b070
7 changed files with 36 additions and 428 deletions

View File

@@ -5,7 +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.docker.com/r/anduin2019/howtocook)
[![Docker](https://img.shields.io/badge/docker-latest-blue?logo=docker)](https://github.com/Anduin2017/HowToCook/pkgs/container/how-to-cook)
最近在家隔离,出不了门。只能宅在家做饭了。作为程序员,我偶尔在网上找找菜谱和做法。但是这些菜谱往往写法千奇百怪,经常中间莫名出来一些材料。对于习惯了形式语言的程序员来说极其不友好。
@@ -13,6 +13,17 @@
同样,我希望它是一个由社区驱动和维护的开源项目,使更多人能够一起做一个有趣的仓库。所以非常欢迎大家贡献它~
## 本地部署
如果需要在本地阅读这个仓库可以在安装 Docker 后运行以下命令:
```bash
docker pull ghcr.io/anduin2017/how-to-cook:latest
docker run -d -p 5000:5000 ghcr.io/anduin2017/how-to-cook:latest
```
下载 PDF 版本,可以在浏览器中访问 [/document.pdf](https://cook.aiursoft.cn/document.pdf)
## 如何贡献
针对发现的问题,直接修改并提交 Pull request 即可。

View File

@@ -17,10 +17,8 @@ jobs:
with:
node-version: '16'
cache: 'npm'
# Generate Readme, mkdocs.
- run: node ./.github/readme-generate.js
# Lint issues first. (Without node_modules)
- run: npm install
- run: npm run build
- run: npm run lint
# Save files.
- uses: stefanzweifel/git-auto-commit-action@v4
@@ -31,17 +29,6 @@ jobs:
commit_user_name: github-actions[bot]
commit_user_email: github-actions[bot]@users.noreply.github.com
commit_author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
# Build docs
# Deprecated. Now use docker.
# - run: echo cook.aiurs.co > CNAME
# - run: mkdir docs && echo cook.aiurs.co > docs/CNAME
# - uses: mhausenblas/mkdocs-deploy-gh-pages@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CUSTOM_DOMAIN: cook.aiurs.co
# CONFIG_FILE: mkdocs.yml
# REQUIREMENTS: requirements.txt
# Use docker to build current directory ./Dockfile
- name: Login to GitHub Container Registry
@@ -51,7 +38,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the hello-world Docker image
- name: Build and push the Docker image
run: |
docker build . --tag ghcr.io/anduin2017/how-to-cook:latest
docker push ghcr.io/anduin2017/how-to-cook:latest