mirror of
https://github.com/mii443/ncb-tts-r2.git
synced 2025-08-22 16:15:29 +00:00
update docker build
This commit is contained in:
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
target
|
||||||
|
audio
|
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@ -9,6 +9,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
name: Checkout
|
||||||
- uses: docker/metadata-action@v3
|
- uses: docker/metadata-action@v3
|
||||||
id: meta
|
id: meta
|
||||||
with:
|
with:
|
||||||
@ -21,9 +22,26 @@ jobs:
|
|||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: morioka22
|
username: morioka22
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
- uses: docker/build-push-action@v2
|
- uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||||
|
- name: Move cache
|
||||||
|
run: |
|
||||||
|
rm -rf /tmp/.buildx-cache
|
||||||
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||||
|
35
Dockerfile
35
Dockerfile
@ -1,18 +1,19 @@
|
|||||||
FROM ubuntu:22.04
|
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
|
||||||
WORKDIR /usr/src/ncb-tts-r2
|
WORKDIR app
|
||||||
ENV PATH $PATH:/root/.cargo/bin/
|
|
||||||
RUN apt-get update \
|
FROM chef AS planner
|
||||||
&& apt-get install -y ffmpeg libssl-dev pkg-config libopus-dev wget curl gcc \
|
COPY . .
|
||||||
&& apt-get -y clean \
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable \
|
FROM chef AS builder
|
||||||
&& rustup install stable
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
COPY Cargo.toml .
|
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg libssl-dev pkg-config libopus-dev gcc && apt-get -y clean
|
||||||
COPY src src
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
RUN cargo build --release \
|
COPY . .
|
||||||
&& cp /usr/src/ncb-tts-r2/target/release/ncb-tts-r2 /usr/bin/ncb-tts-r2 \
|
RUN cargo build --release
|
||||||
&& mkdir -p /ncb-tts-r2/audio \
|
|
||||||
&& apt-get purge -y pkg-config wget curl gcc \
|
FROM debian:bullseye-slim AS runtime
|
||||||
&& rustup self uninstall -y
|
|
||||||
WORKDIR /ncb-tts-r2
|
WORKDIR /ncb-tts-r2
|
||||||
CMD ["ncb-tts-r2"]
|
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates ffmpeg libssl-dev libopus-dev && apt-get -y clean && mkdir audio
|
||||||
|
COPY --from=builder /app/target/release/ncb-tts-r2 /usr/local/bin
|
||||||
|
ENTRYPOINT ["/usr/local/bin/ncb-tts-r2"]
|
||||||
|
Reference in New Issue
Block a user