Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Commit

Permalink
添加 GitHub Actions 自动构建 Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
YukiCoco committed Aug 17, 2022
1 parent d2b1fad commit ca06324
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Docker

on:
push:
tags:
- 'v*' # Push events to every tag not containing /

# Pattern matched against refs/tags
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Test
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore CheapSteam.UI/CheapSteam.UI/CheapSteam.UI.csproj
- name: Publish Linux x64
run: dotnet publish CheapSteam.UI/CheapSteam.UI/CheapSteam.UI.csproj --runtime linux-x64 -p:PublishSingleFile=true --self-contained true -o ./CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64 -c Release
- name: Edit default listen url
run: sed -i 's/127.0.0.1/0.0.0.0/g' ./CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64/appsettings.json
- name: Zip files
run: zip -r CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64.zip ./CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64
- name: Copy bin files
run: cp CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64.zip docker/
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Edit default dockerfile
run: sed -i 's/RELEASE_VERSION/${{ env.RELEASE_VERSION }}/g' docker/dockerfile
-
name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: sayokurisu/cheapsteam:latest,sayokurisu/cheapsteam:${{ env.RELEASE_VERSION }}
context: docker
2 changes: 2 additions & 0 deletions Changelog/v2.1.1-changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## 更新内容
+ 添加 GitHub Actions 自动构建 Docker
7 changes: 7 additions & 0 deletions Docs/Deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
`v2.1.0` 版本后添加了验证模块,您可以在服务器部署 CheapSteam。
此种方式的优点在于你无需通过特殊手段访问 Steam 市场(假定您部署在海外服务器上),而且对市场的爬取速度较为理想。
## 下载
### 直接运行
通过 [发布页](https://github.com/YukiCoco/CheapSteam/releases) 下载适用于 Linux 的程序,然后解压到任意位置。
### 使用 Docker
e.g. `docker container run -d -p 8888:1272 sayokurisu/cheapsteam:v2.1.0`
将 v2.1.0 的 CheapSteam 运行在 8888 端口上,此时可通过 HTTP 8888 端口直接访问
**进入程序后请在设置页面勾选 `开启网页验证`**
## 部署
### 反向代理
将下列配置文件添加到 nginx 的配置中,一般路径为 `/etc/nginx/sites-enabled/`
Expand Down Expand Up @@ -47,5 +52,7 @@ Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
WantedBy=multi-user.target
````
`systemctl start cheapsteam` 开启运行 CheapSteam
## 设置
**进入程序后请在设置页面勾选 `开启网页验证`**
## 完成
此时可以访问你的域名进入程序
8 changes: 4 additions & 4 deletions docker/dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM bitnami/aspnet-core:6.0.8-debian-11-r3

COPY CheapSteam-v2.1.0-linux-x64.zip /app/
COPY CheapSteam-RELEASE_VERSION-linux-x64.zip /app/
WORKDIR /app

RUN apt-get update \
&& apt-get install -y unzip \
&& unzip CheapSteam-v2.1.0-linux-x64.zip \
&& chmod 755 /app/CheapSteam-v2.1.0-linux-x64/CheapSteam.UI
&& unzip CheapSteam-RELEASE_VERSION-linux-x64.zip \
&& chmod 755 /app/CheapSteam-RELEASE_VERSION-linux-x64/CheapSteam.UI

WORKDIR /app/CheapSteam-v2.1.0-linux-x64
WORKDIR /app/CheapSteam-RELEASE_VERSION-linux-x64

CMD [ "./CheapSteam.UI" ]

0 comments on commit ca06324

Please sign in to comment.