Skip to content

Commit

Permalink
Dockerfile simplifications (#16)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
martinbjeldbak authored Nov 28, 2023
1 parent 863fbb5 commit 01166cc
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 45 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/build-and-push-docker.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -37,14 +38,19 @@ 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
with:
push: true
sbom: true
provenance: true
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

Expand Down
1 change: 0 additions & 1 deletion .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ignored:
- "DL3008" # pin versions in apt install
- "DL3013" # pin versions in pip
- "DL3059" # Multiple consecutive `RUN` instructions. Consider consolidation.
48 changes: 22 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax=docker/dockerfile:1

FROM ubuntu:18.04

LABEL \
Expand All @@ -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"]
61 changes: 49 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://wiki.acestream.media/Install_Ubuntu> 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 <https://wiki.acestream.media/Install_Ubuntu>.

For a list of AceStream versions, see here: <https://docs.acestream.net/products/#linux>

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
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '3'
version: '3.9'
services:
app:
build: .
ports:
- '6878:6878'
- '6878:80'

0 comments on commit 01166cc

Please sign in to comment.