Docker updates.

This commit is contained in:
Dessalines 2019-04-10 15:48:23 -07:00
parent 85a7e2a8c9
commit 2a08137168
5 changed files with 34 additions and 17 deletions

View File

@ -3,3 +3,5 @@ server/ui/dist
server/service/target
new_torrents_fetcher
.git
torrents.db
backups

View File

@ -6,8 +6,16 @@ RUN yarn
RUN yarn build
FROM rust:1.33 as rust
COPY server/service /app/server/service
WORKDIR /app/server
# cache the build
RUN USER=root cargo new service
WORKDIR /app/server/service
# copy over your manifests
COPY server/service/Cargo.toml server/service/Cargo.lock ./
RUN cargo build --release
RUN rm src/*.rs
COPY server/service/src ./src
RUN rm -r ./target/release/.fingerprint/torrents-csv-*
RUN cargo build --release
FROM debian:jessie-slim as volume

View File

@ -34,7 +34,12 @@ rm torrents_removed_quotes.csv
# Cache torrent files if they exist
if [ -f $torrent_files_json ]; then
echo "Building files DB from $torrent_files_json ..."
jq -r 'to_entries[] | {hash: .key, val: .value[]} | [.hash, .val.i, .val.p, .val.l] | join(";")' $torrent_files_json > torrent_files_temp
# Old way, doesn't work with too much ram
# jq -r 'to_entries[] | {hash: .key, val: .value[]} | [.hash, .val.i, .val.p, .val.l] | join(";")' $torrent_files_json > torrent_files_temp
# New way, credit to ogusismail : https://stackoverflow.com/a/55600294/1655478
jq --stream -n -r 'foreach inputs as $pv ([[],[]]; if ($pv|length) == 2 then (.[0] |= if . == [] then . + [$pv[0][0],$pv[1]] else . + [$pv[1]] end) else [[],.[0]] end; if .[0] == [] and .[1] != [] then .[1] else empty end) | join(";")' $torrent_files_json > torrent_files_temp
# Removing those with too many ;
rg "^([^;]*;){3}[^;]+$" torrent_files_temp > torrent_files_temp_2

View File

@ -69,12 +69,14 @@ a::-moz-focus-inner {
.icon {
display: inline-flex;
width: .8em;
height: .8em;
top: .125em;
width: 1em;
height: 1em;
stroke-width: 0;
stroke: currentColor;
fill: currentColor;
vertical-align: initial;
vertical-align: baseline;
align-self: center;
}
.spinner {

View File

@ -153,18 +153,18 @@ export class Search extends Component<any, State> {
{moment(torrent.created_unix * 1000).fromNow()}
</td>
<td class="text-right">
<a class="btn btn-sm no-outline p-1"
<a class="btn btn-sm no-outline px-1"
href={magnetLink(torrent.infohash, (torrent.name) ? torrent.name : torrent.path, torrent.index_)}
data-balloon="Magnet link"
data-balloon-pos="left">
<svg class="icon icon-magnet"><use xlinkHref="#icon-magnet"></use></svg>
<svg class="icon"><use xlinkHref="#icon-magnet"></use></svg>
</a>
<a class="btn btn-sm no-outline p-1 d-none d-sm-inline"
<a class="btn btn-sm no-outline px-1 d-none d-sm-inline"
href={`https://gitlab.com/dessalines/torrents.csv/issues/new?issue[title]=Report%20Torrent%20infohash%20${torrent.infohash}`}
target="_blank"
data-balloon="Report Torrent"
data-balloon-pos="left">
<svg class="icon icon-flag"><use xlinkHref="#icon-flag"></use></svg>
<svg class="icon"><use xlinkHref="#icon-flag"></use></svg>
</a>
</td>
</tr>