-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
37 lines (25 loc) · 896 Bytes
/
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
FROM alpine:latest as builder
# For some reason the standard rust builder image does not work at all!
RUN apk add --update --no-cache cargo rust rust-gdb rust-src rust-lldb
RUN apk add --update --no-cache musl-dev pkgconfig openssl-dev opus-dev
WORKDIR /usr/src/tsmusicbot
COPY . .
RUN --mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/usr/src/tsmusicbot/target \
cargo install --path .
FROM alpine:latest as final
# Switch to root
USER root
RUN apk add --update --no-cache ffmpeg youtube-dl opus
# Set user and group
ARG user=bot
ARG group=bot
ARG uid=2000
RUN adduser --uid=${uid} --disabled-password --gecos="" ${user}
USER ${uid}:${uid}
WORKDIR $HOME
COPY --from=builder /root/.cargo/bin/tsmusicbot /usr/local/bin/tsmusicbot
COPY config.json.default /opt/tsmusicbot/config.json
VOLUME /opt/tsmusicbot
ENV RUST_LOG=TRACE
ENTRYPOINT ["tsmusicbot"]