8000 ci: build and push docker image by 117503445 · Pull Request #23 · Mythologyli/zju-connect · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ci: build and push docker image #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations 8000
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,46 @@ jobs:
run: |
gh release upload ${{ github.event.release.tag_name }} zju-connect-${{ steps.get_filename.outputs.ASSET_NAME }}.zip


# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

# https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# https://github.com/docker/metadata-action
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
mythologyli/zju-connect
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{ma F740 jor}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=latest

# https://github.com/docker/build-push-action
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,28 @@

#### Docker 运行

拷贝源码

```zsh
$ git clone git@github.com:Mythologyli/zju-connect.git
$ docker run -d --name zju-connect -v $PWD/config.toml:/home/nonroot/config.toml -p 1080:1080 -p 1081:1081 --restart unless-stopped Mythologyli/zju-connect
```

本地构建镜像并运行

```zsh
$ docker build -t zju-connect .
$ docker run -d --name zju-connect -v $PWD/config.toml:/home/nonroot/config.toml -p 1080:1080 -p 1081:1081 --restart unless-stopped zju-connect
也可以使用 Docker Compose。创建 `docker-compose.yml` 文件,内容如下:

```yaml
version: '3'

services:
zju-connect:
image: Mythologyli/zju-connect
container_name: zju-connect
restart: unless-stopped
ports:
- 1080:1080
- 1081:1081
volumes:
- ./config.toml:/home/nonroot/config.toml
```

也可以使用 Docker Compose
并在同目录下运行

```zsh
$ docker compose up -d
Expand Down
0