From 01166cceadaa368beeb4fe3987eafd3c96274d5a Mon Sep 17 00:00:00 2001 From: Martin Bjeldbak Madsen Date: Wed, 29 Nov 2023 00:38:59 +1100 Subject: [PATCH] Dockerfile simplifications (#16) * Initial Caddy install with reverse_proxy to ace * Prevent http-to-https redirect * README updates after adding reverse proxy * Readme clarifications * Re-enabled non-root user * hadolint fixes * Clarify ARM not supported in README * Remove setting of USER * README update * Try improving push action * No install recommends * Remove ignored hadolint rule * Remove comment in dockerfile * Simplify docker compose * Install just what's needed * Explicitly start with Caddyfile * Don't build for arm, unable to run * Improved logging direct to stderr * Testing redirects * Remove Caddy * Simplify dockerfile by installing acestream deps * Lint fix * Lint fix 2 * Revert ports because I know it works * Run on port 80 * Clarify docs on HLS * More readme improvements * Fix port in README * Typo * Try backwards compatible change * Run on port 80 For some reason this seems to work always, but requires a breaking change since default port is being changed and port mappings need to be updated --- .github/workflows/build-and-push-docker.yml | 14 +++-- .hadolint.yaml | 1 - Dockerfile | 48 ++++++++-------- README.md | 61 +++++++++++++++++---- docker-compose.yml | 4 +- 5 files changed, 83 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index f16364b..28be7ca 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -1,10 +1,11 @@ name: Build and push Docker image to DockerHub on: - release: - types: [published] + push: + tags: + - 'v*' jobs: - push_to_registries: + push-to-registries: name: Push Docker image to Docker Hub and GitHub Packages runs-on: ubuntu-latest steps: @@ -37,6 +38,11 @@ jobs: images: | ${{ github.repository }} ghcr.io/${{ github.repository }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} - name: Build and push Docker images uses: docker/build-push-action@v5 @@ -44,7 +50,7 @@ jobs: push: true sbom: true provenance: true - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.hadolint.yaml b/.hadolint.yaml index e64aacc..49c6f6e 100644 --- a/.hadolint.yaml +++ b/.hadolint.yaml @@ -1,4 +1,3 @@ ignored: - "DL3008" # pin versions in apt install - "DL3013" # pin versions in pip - - "DL3059" # Multiple consecutive `RUN` instructions. Consider consolidation. diff --git a/Dockerfile b/Dockerfile index 1125773..1c130fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ # syntax=docker/dockerfile:1 + FROM ubuntu:18.04 LABEL \ @@ -11,31 +12,26 @@ LABEL \ ENV ACESTREAM_VERSION="3.1.75rc4_ubuntu_18.04_x86_64_py3.8" -RUN apt-get update && apt-get install --no-install-recommends -y \ - wget \ - gcc \ - python3.8 \ - python3-dev \ - python3-pip \ - python3-setuptools \ - libpython3.8-dev \ - libssl-dev \ - libxml2-dev \ - libxslt-dev \ - swig \ - libffi-dev \ - net-tools \ - && rm -rf /var/lib/apt/lists/* - -RUN python3.8 -m pip install --no-cache-dir certifi PyNaCl pycryptodome apsw lxml - -RUN wget --progress=dot:giga "https://download.acestream.media/linux/acestream_${ACESTREAM_VERSION}.tar.gz" && \ - mkdir acestream && \ - tar zxf "acestream_${ACESTREAM_VERSION}.tar.gz" -C acestream && \ - mv acestream /opt/acestream - -# Document that we are exposing this as the HTTP API port -EXPOSE 6878/tcp +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Install acestream dependencies +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + python3.8 ca-certificates wget sudo \ + && rm -rf /var/lib/apt/lists/* \ + # + # Download acestream + && wget --progress=dot:giga "https://download.acestream.media/linux/acestream_${ACESTREAM_VERSION}.tar.gz" \ + && mkdir acestream \ + && tar zxf "acestream_${ACESTREAM_VERSION}.tar.gz" -C acestream \ + && rm "acestream_${ACESTREAM_VERSION}.tar.gz" \ + && mv acestream /opt/acestream \ + && pushd /opt/acestream || exit \ + && bash ./install_dependencies.sh \ + && popd || exit + + +EXPOSE 80/tcp ENTRYPOINT ["/opt/acestream/start-engine"] -CMD ["--client-console"] +CMD ["--client-console", "--http-port", "80"] diff --git a/README.md b/README.md index 307fee3..22d8102 100644 --- a/README.md +++ b/README.md @@ -2,38 +2,75 @@ [![Build and push Docker image to DockerHub](https://github.com/martinbjeldbak/acestream-http-proxy/actions/workflows/build-and-push-docker.yml/badge.svg?event=release)](https://github.com/martinbjeldbak/acestream-http-proxy/actions/workflows/build-and-push-docker.yml) [![Lint](https://github.com/martinbjeldbak/acestream-http-proxy/actions/workflows/lint-dockerfile.yml/badge.svg)](https://github.com/martinbjeldbak/acestream-http-proxy/actions/workflows/lint-dockerfile.yml) -This docker image installs and runs the AceStream Engine in Ubuntu and exposes the [HTTP API](https://docs.acestream.net/en/developers/connect-to-engine/). +This Docker image runs the AceStream Engine and exposes its [HTTP +API](https://docs.acestream.net/en/developers/connect-to-engine/). -As a result, you will be able to watch live AceStream sources without needing to install the AceStream player or other dependencies locally. +As a result, you will be able to watch AceStreams over HLS or MPEG-TS, without +needing to install the AceStream player or any other dependencies locally. -This is especially useful for MacOS, Raspberry Pi's and XMBC users who want to tune in to AceStream channels. +This is especially useful for Desktop and NAS usage for anyone who wants to +tune in to AceStream channels, and who don't want to go through the trouble of +installing AceStream and its dependencies natively. + +Note: ARM-based CPUs are not currently supported, see issues [#5] and [#13]. ## Usage -Ensure you have [docker](https://www.docker.com) installed and running. You can then pull down and run the container as shown below. +Ensure you have [Docker](https://www.docker.com) installed and running. You can then pull down and run the container as shown below. ```console -$ docker run -t -p 6878:6878 ghcr.io/martinbjeldbak/acestream-http-proxy +docker run -t -p 80:80 ghcr.io/martinbjeldbak/acestream-http-proxy ``` -You are then able to access live AceSream content by pointing your favorite media player (VLC, IINA, etc.) to the below network URL +You are then able to access AceStreams by pointing your favorite media player +(VLC, IINA, etc.) to either of the below URLs, depending on the desired +streaming protocol. +For HLS: +```console +http://127.0.0.1/ace/manifest.m3u8?id=dd1e67078381739d14beca697356ab76d49d1a2 ``` -http://127.0.0.1:6878/ace/getstream?id=dd1e67078381739d14beca697356ab76d49d1a2d + +For MPEG-TS: + +```console +http://127.0.0.1/ace/getstream?id=dd1e67078381739d14beca697356ab76d49d1a2 ``` -Where `dd1e67078381739d14beca697356ab76d49d1a2d` is the ID of the desired AceStream channel. +where `dd1e67078381739d14beca697356ab76d49d1a2d` is the ID of the AceStream channel. + +This image can also be deployed to a server, where it can proxy AceStream +content over HTTP. ## Contributing -Ensure you have docker installed with support for docker-compose. +First of all, thanks! -Dockerfile steps are roughly guided by and AUR packages https://aur.archlinux.org/packages/acestream-engine-stable +Ensure you have Docker installed with support for docker-compose, as outlined +above. This image is simply a simplified wrapper around the +[AceStream][acestream] HTTP API in order to make it more user friendly to get +running. All options supported by the AceStream Engine are supported in this +project. Any contributions to support more configuration is greatly +appreciated! + +Dockerfile steps are roughly guided by . For a list of AceStream versions, see here: -For convenience of easy image rebuilding, this repository contains a [`docker-compose.yml` ](https://github.com/martinbjeldbak/acestream-http-proxy/blob/master/docker-compose.yml) file. You can then build & run the image locally by running the following command +For convenience of easy image rebuilding, this repository contains a +[`docker-compose.yml`](./docker-compose.yml) file. You can then build & run the +image locally by running the following command: ```console -$ docker-compose up --build +docker-compose up --build ``` + +The image will now be running, with the following ports exposed: + +- **6878**: AceStream engine port. Docs for command line arguments and debugging +can be found [here][acestream] + + +[acestream]: https://docs.acestream.net/en/developers/ +[#5]: https://github.com/martinbjeldbak/acestream-http-proxy/issues/5 +[#13]: https://github.com/martinbjeldbak/acestream-http-proxy/issues/13 diff --git a/docker-compose.yml b/docker-compose.yml index c256e9a..17fc159 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ -version: '3' +version: '3.9' services: app: build: . ports: - - '6878:6878' + - '6878:80'