Skip to content

Commit

Permalink
ci: add docker build ci
Browse files Browse the repository at this point in the history
  • Loading branch information
teamssix committed Aug 12, 2022
1 parent 1c77b32 commit 3a37c11
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 11 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Docker image
on:
push:
branches:
- 'main'

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: teamssix/twiki

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:12.22.12
LABEL maintainer="teamssix <https://wiki.teamssix.com>"
COPY . /TWiki
WORKDIR /TWiki
RUN yarn install && yarn docs:build
FROM nginx:alpine
COPY --from=0 /TWiki/docs/.vuepress/dist/ /usr/share/nginx/html/
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@

文库的地址为:[wiki.teamssix.com](https://wiki.teamssix.com/)

## 本地开发预览
## 本地部署

```bash
git clone https://github.com/teamssix/TWiki.git --depth 1
cd TWiki
npm install --global yarn
yarn install
yarn docs:dev
```

## 生成并部署
> 注意:node 版本需要大于或等于 12
```bash
git clone https://github.com/teamssix/TWiki.git --depth 1
Expand All @@ -30,7 +22,14 @@ yarn docs:build

build 完之后,将 docs/.vuepress/dist 目录下的文件复制到你的 nginx 或者 apache 服务的网站根目录下即可。

> 注意:node 版本需要大于或等于 12
## Docker 部署

```bash
docker pull teamssix/twiki
docker run --name twiki -d -p 7777:80 twiki
```

然后访问本地 IP 的 7777 端口即可。

## 感谢以下为 T Wiki 文库贡献的师傅们 :confetti_ball:

Expand Down

0 comments on commit 3a37c11

Please sign in to comment.