mirror of
https://github.com/mii443/ncb-tts-r2.git
synced 2025-08-22 08:05:48 +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
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
name: Checkout
|
||||
- uses: docker/metadata-action@v3
|
||||
id: meta
|
||||
with:
|
||||
@ -21,9 +22,26 @@ jobs:
|
||||
registry: ghcr.io
|
||||
username: morioka22
|
||||
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
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
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
|
||||
WORKDIR /usr/src/ncb-tts-r2
|
||||
ENV PATH $PATH:/root/.cargo/bin/
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y ffmpeg libssl-dev pkg-config libopus-dev wget curl gcc \
|
||||
&& apt-get -y clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable \
|
||||
&& rustup install stable
|
||||
COPY Cargo.toml .
|
||||
COPY src src
|
||||
RUN cargo build --release \
|
||||
&& cp /usr/src/ncb-tts-r2/target/release/ncb-tts-r2 /usr/bin/ncb-tts-r2 \
|
||||
&& mkdir -p /ncb-tts-r2/audio \
|
||||
&& apt-get purge -y pkg-config wget curl gcc \
|
||||
&& rustup self uninstall -y
|
||||
FROM lukemathwalker/cargo-chef:latest-rust-1 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 apt-get update && apt-get install -y --no-install-recommends ffmpeg libssl-dev pkg-config libopus-dev gcc && apt-get -y clean
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY . .
|
||||
RUN cargo build --release
|
||||
|
||||
FROM debian:bullseye-slim AS runtime
|
||||
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