Skip to content

Commit

Permalink
feat: Archive python version
Browse files Browse the repository at this point in the history
  • Loading branch information
jetsung committed Dec 10, 2024
1 parent 0e27a94 commit e4364b1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 96 deletions.
125 changes: 39 additions & 86 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,114 +18,67 @@ on:
jobs:
build-ghcr:
name: Build And Push to ghcr.io
runs-on: ubuntu-latest
runs-on: ubuntu:latest
env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_REGISTRY: ghcr.io
REPOSITORY: ${{ github.repository }}
steps:
- uses: actions/checkout@v3

- name: Log in to ghcr.io
uses: redhat-actions/podman-login@v1
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to ghcr.io
uses: docker/login-action@v3
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}

- name: Get Information
id: information
env:
PIP_MIRROR_URL: ${{ secrets.PIP_MIRROR_URL }}
run: |
if [[ -z "${PIP_MIRROR_URL}" ]]; then
PIP_MIRROR_URL="https://pypi.org/simple"
fi
echo "PIP_MIRROR_URL: ${PIP_MIRROR_URL}"
echo "PIP_MIRROR_URL=$PIP_MIRROR_URL" >> $GITHUB_OUTPUT
BUILD_TAG="latest"
echo "tag: ${BUILD_TAG}"
if [[ "${{ github.ref_name }}" != "main" ]]; then
BUILD_TAG="${{ github.ref_name }}-${{ matrix.arch }}"
fi
echo "BUILD_TAG: ${BUILD_TAG}"
echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_OUTPUT
sudo apt install qemu-user-static -y
- name: Buildah Action
id: build-image
uses: redhat-actions/buildah-build@v2
env:
PIP_MIRROR_URL: ${{ steps.information.outputs.PIP_MIRROR_URL }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
image: ${{ env.REPOSITORY }}
tags: "${{ steps.information.outputs.BUILD_TAG }}"
containerfiles: |
./Containerfile
build-args: |
PIP_MIRROR_URL=${{ env.PIP_MIRROR_URL }}
platforms: linux/amd64,linux/arm64
context: .
extra-args: |
--squash
--timestamp 0
- name: Push To ghcr.io
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
file: ./Containerfile
platforms: linux/amd64
push: true
tags: ${{ env.IMAGE_REGISTRY }}/idevsig/filetas:python

build-docker:
name: Build And Push Docker Hub
runs-on: ubuntu-latest
name: Build And Push to Docker Hub
runs-on: ubuntu:latest
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE: filetas

steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Get Information
id: information
env:
PIP_MIRROR_URL: ${{ secrets.PIP_MIRROR_URL }}
run: |
if [[ -z "${PIP_MIRROR_URL}" ]]; then
PIP_MIRROR_URL="https://pypi.org/simple"
fi
echo "PIP_MIRROR_URL: ${PIP_MIRROR_URL}"
echo "PIP_MIRROR_URL=$PIP_MIRROR_URL" >> $GITHUB_OUTPUT
BUILD_TAG="${{ github.ref_name }}-${{ matrix.arch }}"
echo "tag: ${BUILD_TAG}"
if [[ "${{ github.ref_name }}" = "main" ]]; then
BUILD_TAG="latest"
fi
echo "BUILD_TAG: ${BUILD_TAG}"
echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_OUTPUT
docker buildx create --use
- name: Build and push
id: dockerbuild
uses: docker/build-push-action@v4
-
name: Build and push
uses: docker/build-push-action@v6
with:
build-args: |
PIP_MIRROR_URL=${{ steps.information.outputs.PIP_MIRROR_URL }}
context: .
file: ./Containerfile
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: true
tags: ${{ env.DOCKERHUB_USERNAME }}/${{ env.IMAGE }}:${{ steps.information.outputs.BUILD_TAG }}
tags: idevsig/filetas:python
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

基于 Python + Flask 的文件传输加速服务 (File transfer acceleration service)

- https://git.jetsung.com/idev/filetas
- https://framagit.org/idev/filetas
- https://github.com/idev-sig/filetas

## Python

1. 下载源码

```bash
git clone https://github.com/idev-sig/filetas.git
git clone https://github.com/idevsig/filetas.git
```

2. 安装依赖
Expand Down Expand Up @@ -53,15 +49,15 @@ gunicorn app:app -D

使用本项目提供的镜像

- ghcr.io: https://github.com/idev-sig/filetas/packages
- Docker Hub: https://hub.docker.com/r/jetsung/filetas
- ghcr.io: https://github.com/idevsig/filetas/packages
- Docker Hub: https://hub.docker.com/r/idevsig/filetas

```bash
# docker.io
docker run -p 8000:8000 -d jetsung/filetas:latest
docker run -p 8000:8000 -d idevsig/filetas:python

# ghcr.io
docker run -p 8000:8000 -d ghcr.io/idev-sig/filetas:latest
docker run -p 8000:8000 -d ghcr.io/idevsig/filetas:python
```

### 构建
Expand Down Expand Up @@ -93,7 +89,7 @@ docker run -p 8000:8000 -d filetas gunicorn -w 4 -b 0.0.0.0:8000 app:app
version: "3"
services:
filetas:
image: jetsung/filetas:latest
image: idevsig/filetas:python
container_name: filetas
restart: unless-stopped
environment:
Expand All @@ -109,3 +105,10 @@ services:
- TITLE=文件传输加速服务 # 网站标题
- USERNAME= # BasicAuth 用户名
- PASSWORD= # BasicAuth 密码
---
## 仓库镜像
- https://git.jetsung.com/idev/filetas
- https://framagit.org/idev/filetas
- https://gitcode.com/idev/filetas
- https://github.com/idevsig/filetas

0 comments on commit e4364b1

Please sign in to comment.