Add transcoder's dockerfile

This commit is contained in:
Zoe Roux 2023-04-06 01:46:25 +09:00
parent bc6fdec360
commit d106988fd7
No known key found for this signature in database
11 changed files with 81 additions and 4 deletions

View File

@ -41,6 +41,7 @@ jobs:
- name: Lint
run: yarn lint
scanner:
name: "Lint scanner"
runs-on: ubuntu-latest
@ -54,3 +55,18 @@ jobs:
run: |
pip install black-with-tabs
black . --check
transcoder:
name: "Lint transcoder"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./transcoder
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@stable
- name: Run cargo fmt
run: |
cargo fmt --check

View File

@ -24,6 +24,9 @@ jobs:
- context: ./scanner
label: scanner
image: zoriya/kyoo_scanner
- context: ./transcoder
label: transcoder
image: zoriya/kyoo_transcoder
name: Build ${{matrix.label}}
steps:
- uses: actions/checkout@v2

View File

@ -29,6 +29,6 @@ COPY --from=transcoder /transcoder/libtranscoder.so /app
WORKDIR /kyoo
EXPOSE 5000
HEALTHCHECK CMD curl --fail http://localhost:5000/health || exit
HEALTHCHECK --interval=5s CMD curl --fail http://localhost:5000/health || exit
CMD /app/Kyoo.Host

View File

@ -25,6 +25,6 @@ COPY --from=transcoder /transcoder/libtranscoder.so /app/out/bin/Kyoo.Host/Debug
WORKDIR /kyoo
EXPOSE 5000
ENV DOTNET_USE_POLLING_FILE_WATCHER 1
HEALTHCHECK CMD curl --fail http://localhost:5000/health || exit
HEALTHCHECK --interval=5s CMD curl --fail http://localhost:5000/health || exit
CMD dotnet watch run --no-restore --project /app/src/Kyoo.Host

View File

@ -50,6 +50,17 @@ services:
volumes:
- ${LIBRARY_ROOT}:/video
transcoder:
build:
context: ./transcoder
dockerfile: Dockerfile.dev
ports:
- "7666:7666"
restart: on-failure
volumes:
- ./transcoder:/app
- ${LIBRARY_ROOT}:/video
ingress:
image: nginx
restart: on-failure

View File

@ -34,6 +34,12 @@ services:
volumes:
- ${LIBRARY_ROOT}:/video
transcoder:
image: zoriya/kyoo_transcoder:edge
restart: on-failure
volumes:
- ${LIBRARY_ROOT}:/video
ingress:
image: nginx
restart: on-failure

View File

@ -34,6 +34,12 @@ services:
volumes:
- ${LIBRARY_ROOT}:/video
transcoder:
build: ./transcoder
restart: on-failure
volumes:
- ${LIBRARY_ROOT}:/video
ingress:
image: nginx
restart: on-failure

View File

@ -1,4 +1,4 @@
FROM node:16-alpine AS builder
FROM node:16-alpine
RUN apk add git bash
WORKDIR /app
COPY .yarn ./.yarn
@ -14,4 +14,4 @@ RUN yarn --immutable
ENV NEXT_TELEMETRY_DISABLED 1
EXPOSE 3000
EXPOSE 19000
CMD ["yarn", "dev"]
CMD yarn dev

View File

@ -15,6 +15,7 @@ in
python3
python3Packages.pip
cargo
cargo-watch
rustfmt
rustc
];

20
transcoder/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM rust as builder
WORKDIR /app
# FIX: see https://github.com/rust-lang/cargo/issues/2644
RUN mkdir src/ && touch src/lib.rs
COPY Cargo.toml Cargo.lock ./
RUN cargo build
RUN rm src/lib.rs
COPY src src
RUN cargo install --path .
FROM debian:bullseye-slim
#RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/transcoder ./transcoder
ENV ROCKET_ADDRESS=0.0.0.0
ENV ROCKET_PORT=7666
EXPOSE 7666
CMD ./transcoder

14
transcoder/Dockerfile.dev Normal file
View File

@ -0,0 +1,14 @@
FROM rust
RUN cargo install cargo-watch
WORKDIR /app
# FIX: see https://github.com/rust-lang/cargo/issues/2644
RUN mkdir src/ && touch src/lib.rs
COPY Cargo.toml Cargo.lock ./
RUN cargo build
RUN rm src/lib.rs
ENV ROCKET_ADDRESS=0.0.0.0
ENV ROCKET_PORT=7666
EXPOSE 7666
CMD cargo watch -x run