-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7579 from jutoft/bugfix/update-docker-deps
Update Dockerfile to use Python base image and add input args
- Loading branch information
Showing
6 changed files
with
98 additions
and
36 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 |
---|---|---|
@@ -1,29 +1,44 @@ | ||
# The base image already builds the libtorrent dependency so only Python pip packages | ||
# are necessary to be installed to run Tribler core process. | ||
FROM triblercore/libtorrent:1.2.10-x | ||
# libtorrent-1.2.19 does not support python 3.11 yet | ||
FROM python:3.10-slim | ||
|
||
# Update the base system and install required libsodium and Python pip | ||
RUN apt update && apt upgrade -y | ||
RUN apt install -y libsodium23 python3-pip git | ||
|
||
RUN useradd -ms /bin/bash user | ||
USER user | ||
WORKDIR /home/user | ||
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. | ||
RUN mkdir requirements | ||
COPY ./requirements-core.txt requirements/core-requirements.txt | ||
RUN pip3 install -r requirements/core-requirements.txt | ||
COPY ./requirements-core.txt /app/tribler/core-requirements.txt | ||
RUN pip3 install -r /app/tribler/core-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 ./ tribler | ||
WORKDIR /home/user/tribler | ||
COPY ./src /app/tribler/src/ | ||
WORKDIR /app/tribler/ | ||
|
||
# Set the REST API port and expose it | ||
# Set to -1 to use the default | ||
ENV CORE_API_PORT=20100 | ||
EXPOSE 20100 | ||
ENV IPV8_PORT=7759 | ||
ENV TORRENT_PORT=-1 | ||
ENV DOWNLOAD_DIR=/downloads | ||
ENV TSTATEDIR=/state | ||
ENV HTTP_HOST=127.0.0.1 | ||
ENV HTTPS_HOST=127.0.0.1 | ||
|
||
VOLUME /state | ||
VOLUME /downloads | ||
|
||
USER user | ||
|
||
# Only run the core process with --core switch | ||
CMD ["./src/tribler.sh", "--core"] | ||
CMD exec python3 /app/tribler/src/run_tribler_headless.py \ | ||
--ipv8=${IPV8_PORT} \ | ||
--libtorrent=${TORRENT_PORT} \ | ||
--restapi_http_host=${HTTP_HOST} \ | ||
--restapi_https_host=${HTTPS_HOST} \ | ||
"--statedir=${TSTATEDIR}" \ | ||
"--download_dir=${DOWNLOAD_DIR}" |
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
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
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
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
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