This commit is contained in:
xtaodada 2023-02-11 18:26:49 +08:00
parent 0040a78a2d
commit 7584e161e9
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 12 additions and 43 deletions

View File

@ -3,9 +3,12 @@ name: "Docker Build"
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
workflow_dispatch: ~
push:
branches: [ main ]
workflow_dispatch:
inputs:
tags:
description: 'main version tag, example: v3'
required: true
default: 'v3'
jobs:
build:
@ -16,6 +19,7 @@ jobs:
DOCKER_CLI_EXPERIMENTAL: enabled
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_REPOSITORY: ${{ secrets.DOCKER_REPO }}
DOCKER_TAG: ${{ github.event.inputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v2
@ -36,6 +40,10 @@ jobs:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx
- name: Download Dockerfile
run: |
wget -O Dockerfile https://raw.githubusercontent.com/luoshuijs/TGPaimonBot/main/Dockerfile
- name: Build
run: |
docker buildx build \
@ -43,7 +51,6 @@ jobs:
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--output "type=image,push=true" \
--platform "linux/amd64,linux/arm64/v8" \
--build-arg "S6_ARCH=amd64" \
--tag "${DOCKERHUB_REPOSITORY}:latest" \
--tag "${DOCKERHUB_REPOSITORY}:${DOCKER_TAG}" \
-f Dockerfile \
.

View File

@ -1,38 +0,0 @@
FROM python:3.10.10-buster
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
LANG=zh_CN.UTF-8 \
SHELL=/bin/bash
SHELL ["/bin/bash", "-c"]
WORKDIR /app
RUN echo "deb http://ftp.us.debian.org/debian buster main non-free" >> /etc/apt/sources.list.d/fonts.list \
&& apt update \
# clone
&& apt install git wget curl -y \
&& git clone -b main https://github.com/luoshuijs/TGPaimonBot.git /app \
# install dependencies \
&& pip install virtualenv poetry \
&& python3 -m virtualenv venv/ \
&& . venv/bin/activate \
&& poetry config virtualenvs.create false \
&& poetry source add --default mirrors https://pypi.tuna.tsinghua.edu.cn/simple/ \
&& poetry install \
&& poetry install --extras all \
&& playwright install chromium \
&& playwright install-deps chromium \
## set timezone
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
# create cache folder
&& mkdir cache/ \
# clean
&& apt-get clean -y \
&& rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/* \
~/.cache/pip \
~/.cache/pypoetry \
# Add the wait script to the image
&& wget -O /wait https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait \
&& chmod +x /wait
ENTRYPOINT /wait && venv/bin/alembic upgrade head && venv/bin/python run.py