Skip to content

Commit

Permalink
Added Docker build action
Browse files Browse the repository at this point in the history
  • Loading branch information
qstokkink committed Aug 22, 2024
1 parent 8fd1051 commit 197605c
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: docker-build

on: workflow_dispatch

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export
uses: docker/build-push-action@v6
with:
tags: tribler:latest
outputs: type=docker,dest=/tmp/myimage.tar
file: build/docker/build.Dockerfile
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: myimage
path: /tmp/myimage.tar
33 changes: 33 additions & 0 deletions build/docker/build.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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/*

# Then, install pip dependencies so that it can be cached and does not
# need to be built every time the source code changes.
# This reduces the docker build time.
COPY ./requirements.txt /app/tribler/requirements.txt
RUN pip3 install -r /app/tribler/requirements.txt

RUN useradd -ms /bin/bash user

# Create default state and download directories and set the permissions
RUN chown -R user:user /app
RUN mkdir /state /downloads && chown -R user:user /state /downloads

# Copy the source code and set the working directory
COPY ./src /app/tribler/src/
WORKDIR /app/tribler/

ENV CORE_API_PORT=20100
ENV TSTATEDIR=/state

VOLUME /state
VOLUME /downloads
COPY ./build/docker/configuration.json /state/git/configuration.json

USER user

CMD exec python3 /app/tribler/src/run_tribler.py
22 changes: 22 additions & 0 deletions build/docker/build.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.*
build
doc
scripts

src/run_unit_tests.py
src/tribler/test_integration
src/tribler/test_unit

pyipv8/.*
pyipv8/*.md
pyipv8/*.ini
pyipv8/create_setup_taskmanager.py
pyipv8/create_test_coverage_report.py
pyipv8/github_increment_version.py
pyipv8/run_all_tests.py
pyipv8/setup.py
pyipv8/doc
pyipv8/scripts
pyipv8/stresstest
pyipv8/systemd
pyipv8/ipv8/test
28 changes: 28 additions & 0 deletions build/docker/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"api": {
"http_host": "127.0.0.1",
"https_host": "127.0.0.1"
},
"ipv8": {
"interfaces": [
{
"interface": "UDPIPv4",
"ip": "0.0.0.0",
"port": 7759,
"worker_threads": 8
},
{
"interface": "UDPIPv6",
"ip": "::",
"port": 7760
}
]
},
"libtorrent": {
"port": 0,
"download_defaults": {
"saveas": "/downloads"
}
},
"state_dir": "/state"
}

0 comments on commit 197605c

Please sign in to comment.