Changing build.
This commit is contained in:
parent
41bc588b3e
commit
e3acf3c062
41
Dockerfile
41
Dockerfile
|
@ -1,41 +0,0 @@
|
||||||
FROM node:10-jessie as node
|
|
||||||
#If encounter Invalid cross-device error -run on host 'echo N | sudo tee /sys/module/overlay/parameters/metacopy'
|
|
||||||
COPY server/ui /app/server/ui
|
|
||||||
WORKDIR /app/server/ui
|
|
||||||
RUN yarn
|
|
||||||
RUN yarn build
|
|
||||||
|
|
||||||
FROM rust:latest as rust
|
|
||||||
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
|
|
||||||
COPY torrents.csv /db/
|
|
||||||
COPY torrent_files.csv /db/
|
|
||||||
|
|
||||||
FROM debian:jessie-slim
|
|
||||||
RUN apt update && apt install -y sqlite3 curl
|
|
||||||
RUN curl -LO https://github.com/BurntSushi/ripgrep/releases/download/0.10.0/ripgrep_0.10.0_amd64.deb
|
|
||||||
RUN dpkg -i ripgrep_0.10.0_amd64.deb
|
|
||||||
RUN curl -LO https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
|
|
||||||
RUN chmod +x jq-linux64
|
|
||||||
RUN mv jq-linux64 /usr/bin/jq
|
|
||||||
|
|
||||||
COPY --from=node /app/server/ui/dist /app/dist
|
|
||||||
COPY --from=rust /app/server/service/target/release/torrents-csv-service /app/
|
|
||||||
COPY --from=volume /db/torrents.csv /app/
|
|
||||||
COPY --from=volume /db/torrent_files.csv /app/
|
|
||||||
COPY scripts /app/scripts
|
|
||||||
WORKDIR /app/scripts/
|
|
||||||
RUN ["/bin/bash", "./build_sqlite.sh"]
|
|
||||||
EXPOSE 8080
|
|
||||||
WORKDIR /app/
|
|
20
README.md
20
README.md
|
@ -15,21 +15,34 @@ Its initially populated with a January 2017 backup of the pirate bay, and new to
|
||||||
To request more torrents, or add your own, go [here](https://gitlab.com/dessalines/torrents.csv/issues).
|
To request more torrents, or add your own, go [here](https://gitlab.com/dessalines/torrents.csv/issues).
|
||||||
|
|
||||||
Made with [Rust](https://www.rust-lang.org), [ripgrep](https://github.com/BurntSushi/ripgrep), [Actix](https://actix.rs/), [Inferno](https://www.infernojs.org), [Typescript](https://www.typescriptlang.org/).
|
Made with [Rust](https://www.rust-lang.org), [ripgrep](https://github.com/BurntSushi/ripgrep), [Actix](https://actix.rs/), [Inferno](https://www.infernojs.org), [Typescript](https://www.typescriptlang.org/).
|
||||||
|
|
||||||
## Webserver
|
## Webserver
|
||||||
|
|
||||||
`Torrents.csv` comes with a simple webserver. [Demo Server](https://torrents-csv.ml)
|
`Torrents.csv` comes with a simple webserver. [Demo Server](https://torrents-csv.ml)
|
||||||
### Docker
|
### Docker
|
||||||
```
|
```
|
||||||
git clone https://gitlab.com/dessalines/torrents.csv
|
git clone https://gitlab.com/dessalines/torrents.csv
|
||||||
cd torrents.csv
|
cd torrents.csv/scripts && ./build_sqlite.sh && cd ..
|
||||||
docker-compose up
|
cd docker/prod
|
||||||
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
### Docker Development
|
||||||
|
|
||||||
|
git clone https://gitlab.com/dessalines/torrents.csv
|
||||||
|
cd torrents.csv/scripts && ./build_sqlite.sh && cd ..
|
||||||
|
cd docker/dev
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
### Local
|
### Local
|
||||||
|
|
||||||
#### Requirements
|
#### Requirements
|
||||||
|
|
||||||
- [Rust](https://www.rust-lang.org/)
|
- [Rust](https://www.rust-lang.org/)
|
||||||
- [Yarn](https://yarnpkg.com/en/)
|
- [Yarn](https://yarnpkg.com/en/)
|
||||||
- [SQLite3](https://www.sqlite.org/index.html)
|
- [SQLite3](https://www.sqlite.org/index.html)
|
||||||
- [jq command line JSON parser: Needs at least jq-1.6](https://stedolan.github.io/jq/)
|
|
||||||
#### Running
|
#### Running
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://gitlab.com/dessalines/torrents.csv
|
git clone https://gitlab.com/dessalines/torrents.csv
|
||||||
cd torrents.csv/scripts
|
cd torrents.csv/scripts
|
||||||
|
@ -62,6 +75,7 @@ bleh season 1 (1993-)
|
||||||
link: magnet:?xt=urn:btih:INFO_HASH_HERE
|
link: magnet:?xt=urn:btih:INFO_HASH_HERE
|
||||||
```
|
```
|
||||||
## Uploading / Adding Torrents from a Directory
|
## Uploading / Adding Torrents from a Directory
|
||||||
|
|
||||||
An *upload*, consists of making a pull request after running the `scan_torrents.sh` script, which adds torrents from a directory you choose to the `.csv` file, after checking that they aren't already there, and that they have seeders. It also adds their files to `torrent_files.csv`.
|
An *upload*, consists of making a pull request after running the `scan_torrents.sh` script, which adds torrents from a directory you choose to the `.csv` file, after checking that they aren't already there, and that they have seeders. It also adds their files to `torrent_files.csv`.
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
torrents-csv:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
command: /bin/sh -c /app/torrents-csv-service
|
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- "8902:8080"
|
|
||||||
environment:
|
|
||||||
TORRENTS_CSV_DB_FILE: /app/torrents.db
|
|
||||||
TORRENTS_CSV_FRONT_END_DIR: /app/dist
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
FROM node:10-jessie as node
|
||||||
|
WORKDIR /app/ui
|
||||||
|
|
||||||
|
# Cache deps
|
||||||
|
COPY server/ui/package.json server/ui/yarn.lock ./
|
||||||
|
RUN yarn install --pure-lockfile
|
||||||
|
|
||||||
|
# Build
|
||||||
|
COPY server/ui /app/ui
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
|
FROM rust:1.37 as rust
|
||||||
|
|
||||||
|
# Install musl
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install musl-tools -y
|
||||||
|
RUN rustup target add x86_64-unknown-linux-musl
|
||||||
|
|
||||||
|
# Cache deps
|
||||||
|
WORKDIR /app
|
||||||
|
RUN USER=root cargo new server
|
||||||
|
WORKDIR /app/server/service
|
||||||
|
COPY server/service/Cargo.toml server/service/Cargo.lock ./
|
||||||
|
RUN mkdir -p ./src/bin \
|
||||||
|
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
|
||||||
|
RUN RUSTFLAGS=-Clinker=musl-gcc cargo build --release --target=x86_64-unknown-linux-musl
|
||||||
|
RUN rm -f ./target/x86_64-unknown-linux-musl/release/deps/torrents-csv-*
|
||||||
|
COPY server/service/src ./src/
|
||||||
|
|
||||||
|
# build for release
|
||||||
|
RUN RUSTFLAGS=-Clinker=musl-gcc cargo build --frozen --release --target=x86_64-unknown-linux-musl
|
||||||
|
|
||||||
|
FROM alpine:3.10
|
||||||
|
|
||||||
|
# Copy resources
|
||||||
|
COPY --from=rust /app/server/service/target/x86_64-unknown-linux-musl/release/torrents-csv-service /app/
|
||||||
|
COPY --from=node /app/ui/dist /app/dist
|
||||||
|
RUN addgroup -g 1000 torrents-csv-service
|
||||||
|
RUN adduser -D -s /bin/sh -u 1000 -G torrents-csv-service torrents-csv-service
|
||||||
|
RUN chown torrents-csv-service:torrents-csv-service /app/torrents-csv-service
|
||||||
|
USER torrents-csv-service
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["/app/torrents-csv-service"]
|
|
@ -0,0 +1,16 @@
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
torrents-csv:
|
||||||
|
build:
|
||||||
|
context: ../../
|
||||||
|
dockerfile: docker/dev/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8902:8080"
|
||||||
|
environment:
|
||||||
|
TORRENTS_CSV_DB_FILE: /app/torrents.db
|
||||||
|
TORRENTS_CSV_FRONT_END_DIR: /app/dist
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: ../../torrents.db
|
||||||
|
target: /app/torrents.db
|
|
@ -0,0 +1,14 @@
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
torrents-csv:
|
||||||
|
image: dessalines/torrents-csv:0.0.1
|
||||||
|
ports:
|
||||||
|
- "8902:8080"
|
||||||
|
environment:
|
||||||
|
TORRENTS_CSV_DB_FILE: /app/torrents.db
|
||||||
|
TORRENTS_CSV_FRONT_END_DIR: /app/dist
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: ../../torrents.db
|
||||||
|
target: /app/torrents.db
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
git pull
|
|
||||||
docker-compose up -d --no-deps --build
|
|
|
@ -38,7 +38,8 @@ echo "Building files DB from $torrent_files_csv ..."
|
||||||
sed 's/\"//g' $torrent_files_csv > torrent_files_removed_quotes.csv
|
sed 's/\"//g' $torrent_files_csv > torrent_files_removed_quotes.csv
|
||||||
|
|
||||||
# Removing those with too many ;
|
# Removing those with too many ;
|
||||||
rg "^([^;]*;){3}[^;]+$" torrent_files_removed_quotes.csv > torrent_files_temp_2
|
awk -F \; 'NF == 4' <torrent_files_removed_quotes.csv > torrent_files_temp_2
|
||||||
|
|
||||||
rm torrent_files_removed_quotes.csv
|
rm torrent_files_removed_quotes.csv
|
||||||
mv torrent_files_temp_2 torrent_files_temp
|
mv torrent_files_temp_2 torrent_files_temp
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue