Skip to content

Commit

Permalink
Merge pull request #753 from Guovin/dev
Browse files Browse the repository at this point in the history
feat
  • Loading branch information
Guovin authored Dec 27, 2024
2 parents 5898b86 + 91411d3 commit 74f6e4a
Show file tree
Hide file tree
Showing 5 changed files with 456 additions and 460 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Push Docker Images

on:
workflow_dispatch:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: guovern/iptv-api:latest
build-args: |
APP_WORKDIR=/iptv-api
LITE=False
- name: Build and push Docker image (Lite)
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: guovern/iptv-api:lite
build-args: |
APP_WORKDIR=/iptv-api-lite
LITE=True
37 changes: 19 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ WORKDIR /app

COPY Pipfile* ./

RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv

RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy\
RUN pip install pipenv \
&& PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy \
&& if [ "$LITE" = False ]; then pipenv install selenium; fi

RUN apt-get update && apt-get install -y --no-install-recommends wget tar xz-utils

RUN mkdir /usr/bin-new \
&& case "${TARGETPLATFORM}" in \
"linux/amd64") ARCH="amd64";; \
"linux/arm64") ARCH="arm64";; \
"linux/arm/v7") ARCH="armhf";; \
*) echo "Unsupported architecture"; exit 1;; \
esac \
&& wget -O /tmp/ffmpeg.tar.gz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-${ARCH}-static.tar.xz \
&& tar -xvf /tmp/ffmpeg.tar.gz -C /usr/bin-new/

FROM python:3.13-slim

Expand All @@ -29,21 +39,12 @@ COPY . $APP_WORKDIR

COPY --from=builder /app/.venv /.venv

RUN echo "deb https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware\n \
deb https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware\n" \
> /etc/apt/sources.list

RUN apt-get update && apt-get install -y --no-install-recommends cron ffmpeg

RUN if [ "$LITE" = False ]; then apt-get install -y --no-install-recommends chromium chromium-driver; fi \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/bin-new/* /usr/bin

RUN apt-get update && apt-get install -y --no-install-recommends cron \
&& if [ "$LITE" = False ]; then apt-get install -y --no-install-recommends chromium chromium-driver; fi \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN (crontab -l ; \
echo "0 22 * * * cd $APP_WORKDIR && /.venv/bin/python main.py"; \
Expand Down
2 changes: 0 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pyinstaller = "*"
aiohttp = "*"
flask = "*"
opencc-python-reimplemented = "*"
fake-useragent = "*"
pillow = "*"
m3u8 = "*"

Expand All @@ -35,7 +34,6 @@ async-timeout = "*"
aiohttp = "*"
flask = "*"
opencc-python-reimplemented = "*"
fake-useragent = "*"
gunicorn = "*"
pillow = "*"
m3u8 = "*"
Expand Down
Loading

0 comments on commit 74f6e4a

Please sign in to comment.