Skip to content

Commit

Permalink
👋update github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
zkep committed Feb 22, 2025
1 parent 3c55d51 commit 8692b59
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 3 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/pubish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Docker image

on:
release:
types: [published]

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
zkep/geektime-docs
ghcr.io/${{ github.repository }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker images
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64/v8

23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM python:3.11-slim AS builder-base

ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /app

COPY . ./

RUN pip install -r requirements.txt

RUN python mkdocs.py

RUN mkdocs build

FROM python:3.11-slim AS production

WORKDIR /app

COPY --from=builder-base /app/site ./site

EXPOSE 8091

CMD python -m http.server 8091 --directory /app/site

Check warning on line 23 in Dockerfile

View workflow job for this annotation

GitHub Actions / Push Docker image to multiple registries

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@

> tips: 在线文档支持 PC 浏览器,也支持移动端浏览器
### markdown 本地文档
### 本地部署

#### docker方式
```shell
docker run -d -p 8091:8091 --restart always --name geektime-docs zkep/geektime-docs
```
浏览器访问:<http://127.0.0.1:8091/>

#### 源码方式
```shell
git clone https://github.com/uaxe/geektime-docs.git --depth 1

Expand All @@ -38,7 +45,7 @@ mkdocs serve

#### 1. http Referer导致的裂图,图片不显示

方案1: 某鱼买7天会员,部署mygeektime服务,缓存对应的VIP课程
方案1: VIP用户,部署[mygeektime](https://github.com/zkep/mygeektime)服务,缓存对应的VIP课程

方案2: 推荐本地使用中间代理人服务,拦截请求,改写 http 请求的 Referer 的思路

Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def http_get_base64(uri, timeout) -> (str, str):
default=8000,
help="mkdocs port. Default value is 8000",
)
def make_all_pdf(source, output, timeout, compress, power, port):
def make_all_pdf(source, output, timeout, compress, power, port):
webdriver_options = Options()
webdriver_prefs = {
'profile.default_content_setting_values': {
Expand Down

0 comments on commit 8692b59

Please sign in to comment.