-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (52 loc) · 1.69 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
########
# chef #
########
FROM almalinux:9 AS chef
WORKDIR /insomnia_bot
# Install devel tools
RUN dnf group install -y "Development Tools"
RUN dnf install -y 'dnf-command(config-manager)'
RUN dnf config-manager --set-enabled crb
RUN dnf install -y python3-devel cmake opus-devel
# Install Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Install cargo-chef
RUN cargo install cargo-chef
###########
# planner #
###########
FROM chef AS planner
COPY Cargo.toml .
COPY Cargo.lock .
COPY src/ ./src
RUN cargo chef prepare --recipe-path recipe.json
###########
# builder #
###########
FROM chef AS builder
COPY --from=planner /insomnia_bot/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY Cargo.toml .
COPY Cargo.lock .
COPY src/ ./src
RUN cargo build --release
##########
# Runner #
##########
FROM almalinux:9
RUN dnf install -y epel-release && \
curl -L https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm \
-o /tmp/rpmfusion-free.rpm && \
rpm -i /tmp/rpmfusion-free.rpm && rm /tmp/rpmfusion-free.rpm && \
curl -L https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm \
-o /tmp/rpmfusion-nonfree.rpm && \
rpm -i /tmp/rpmfusion-nonfree.rpm && rm /tmp/rpmfusion-nonfree.rpm && \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --enable crb && \
dnf install -y ffmpeg python3 python3-pip && \
pip3 install ytmusicapi && \
dnf clean all && pip cache purge
WORKDIR /insomnia_bot
COPY --from=builder /insomnia_bot/target/release/insomnia-bot ./
ENTRYPOINT ["/insomnia_bot/insomnia-bot"]