-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Publish Docker Image | ||
|
||
on: workflow_dispatch | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
|
||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
fetch-depth: 0 | ||
submodules: 'true' | ||
fetch-tags: 'true' | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Git Tag Version | ||
id: git_tag_version | ||
run: | | ||
echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV | ||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: build/docker/build.Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
build-args: | | ||
GIT_BRANCH=${{ github.ref_name }} | ||
GIT_REPO=https://github.com/${{ github.repository }} | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# libtorrent-1.2.19 does not support python 3.11 yet | ||
FROM python:3.10-slim | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends libsodium23=1.0.18-1 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Xvfb for headless GUI | ||
RUN apt-get update -y \ | ||
&& apt-get -y install \ | ||
xvfb nodejs npm git \ | ||
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* | ||
|
||
# Set up a user in the container | ||
RUN useradd -ms /bin/bash --home-dir /home/user user | ||
USER user | ||
|
||
# Clone the repository with arguments | ||
ARG GIT_REPO=${GIT_REPO:-"https://github.com/tribler/tribler.git"} | ||
ARG GIT_BRANCH=${GIT_BRANCH:-"main"} | ||
RUN echo "Cloning $GIT_REPO on branch $GIT_BRANCH" | ||
RUN git clone --recursive --branch "$GIT_BRANCH" "$GIT_REPO" /home/user/tribler | ||
|
||
# Install NPM dependencies | ||
WORKDIR /home/user/tribler/src/tribler/ui | ||
RUN npm install \ | ||
&& npm run build | ||
|
||
# Install Python dependencies | ||
WORKDIR /home/user/tribler | ||
RUN pip3 install -r requirements.txt | ||
|
||
# Set IPv8 on pythonpath | ||
ENV PYTHONPATH=pyipv8 | ||
|
||
# Run the application using Xvfb | ||
CMD xvfb-run python3 src/run_tribler.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
services: | ||
tribler: | ||
image: ghcr.io/tribler/tribler:latest | ||
network_mode: host | ||
environment: | ||
CORE_API_PORT: 8085 | ||
CORE_API_KEY: "changeme" | ||
volumes: | ||
- ~/.Tribler/git:/home/user/.Tribler | ||
- ~/Downloads/TriblerDownloads:/home/user/Downloads/TriblerDownloads |