improve docker configs
This commit is contained in:
parent
754397604b
commit
c393cec924
3 changed files with 27 additions and 10 deletions
28
Dockerfile
28
Dockerfile
|
|
@ -1,24 +1,32 @@
|
||||||
# Rust build
|
# Rust build
|
||||||
FROM rust:1-alpine3.19
|
FROM rust:1-alpine3.19 AS builder
|
||||||
|
|
||||||
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
||||||
RUN apk add --no-cache musl-dev openssl-dev
|
RUN apk add --no-cache musl-dev openssl-dev
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /usr/src/app
|
||||||
COPY Cargo.toml Cargo.lock /app/
|
RUN USER=root cargo init
|
||||||
COPY src/ /app/src
|
COPY ./Cargo.toml .
|
||||||
|
COPY Cargo.lock .
|
||||||
|
COPY src/ ./src
|
||||||
|
COPY migrations ./migrations
|
||||||
|
|
||||||
RUN cargo build --release
|
RUN touch src/main.rs && cargo build --release
|
||||||
RUN strip target/release/mk-dl-bot
|
RUN strip target/release/mk-dl-bot
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
FROM alpine:3.19
|
FROM alpine:3.19 AS final
|
||||||
|
# Dependencies
|
||||||
RUN apk add --no-cache libgcc
|
RUN apk add --no-cache libgcc
|
||||||
RUN apk add --no-cache ffmpeg python3 py3-pip
|
RUN apk add --no-cache ffmpeg python3 py3-pip
|
||||||
RUN pip install --break-system-packages yt-dlp
|
RUN pip install --break-system-packages yt-dlp
|
||||||
|
|
||||||
WORKDIR /app
|
# Those directories are required by bot
|
||||||
COPY migrations /app/
|
RUN mkdir -p /var/lib/mk-dl-bot
|
||||||
COPY --from=0 /app/target/release/mk-dl-bot /app/
|
RUN mkdir -p /var/log/mk-dl-bot
|
||||||
|
|
||||||
ENTRYPOINT ["/mk-dl-bot"]
|
WORKDIR /app
|
||||||
|
COPY migrations ./migrations
|
||||||
|
COPY --from=builder /usr/src/app/target/release/mk-dl-bot .
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/mk-dl-bot"]
|
||||||
9
docker-compose-dev.yml
Normal file
9
docker-compose-dev.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
services:
|
||||||
|
mk-dl-bot:
|
||||||
|
build: .
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
- db:/var/lib/mk-dl-bot
|
||||||
|
volumes:
|
||||||
|
db:
|
||||||
Loading…
Add table
Reference in a new issue