Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.github
bin/docker/
data.db
storage/
target/
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/target
**/*.rs.bk
/database.json.bz2
/database.db
/.idea/
/config.toml
/data.db
/database.db
/database.json.bz2
/storage/data.db
/target
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM lukemathwalker/cargo-chef:latest-rust-1.62.0 AS chef
WORKDIR /app


FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json


FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --bin torrust-tracker


FROM debian:bullseye-slim AS runtime
WORKDIR /app

ENV TZ=Etc/UTC \
APP_USER=appuser

RUN groupadd $APP_USER \
&& useradd -g $APP_USER $APP_USER \
&& mkdir -p /app

RUN chown -R $APP_USER:$APP_USER /app

RUN apt-get -y update \
&& apt-get -y upgrade \
&& apt-get install -y sqlite3 libssl1.1

EXPOSE 6969
EXPOSE 1212

COPY --from=builder /app/target/release/torrust-tracker /app

USER $APP_USER

ENTRYPOINT ["/app/torrust-tracker"]
3 changes: 3 additions & 0 deletions bin/docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker build -t torrust-tracker .
7 changes: 7 additions & 0 deletions bin/docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

docker run --rm -it \
-p 6969:6969 -p 1212:1212 \
--volume "$(pwd)/storage":"/app/storage" \
--mount type=bind,source="$(pwd)/config.toml",target=/app/config.toml \
torrust-tracker