add Dockerfile

This commit is contained in:
mii
2022-08-11 14:06:19 +09:00
parent af902c3c97
commit e988afef0d
2 changed files with 40 additions and 7 deletions

View File

@ -1,12 +1,29 @@
on: [push]
on:
push:
branches-ignore:
- '**'
tags:
- 'v*'
jobs:
build_and_test:
name: Rust project
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: docker/metadata-action@v3
id: meta
with:
toolchain: stable
- run: cargo build --release --all-features
images: ghcr.io/morioka22/ncb-tts-r2
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: morioka22
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM ubuntu:22.04
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/*
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
ENV PATH $PATH:/root/.cargo/bin/
RUN rustup install stable
WORKDIR /usr/src/ncb-tts-r2
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
WORKDIR /ncb-tts-r2
CMD ["ncb-tts-r2"]