diff --git a/Dockerfile b/Dockerfile index ab2beed..4bec7cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,12 +6,14 @@ RUN apk add --no-cache musl-dev openssl-dev WORKDIR /usr/src/app RUN USER=root cargo init -COPY ./Cargo.toml . +COPY Cargo.toml . COPY Cargo.lock . COPY src/ ./src -COPY migrations ./migrations +COPY locales/ ./locales/ +COPY migrations/ ./migrations/ -RUN touch src/main.rs && cargo build --release +RUN --mount=type=cache,target=/usr/local/cargo/registry \ + touch src/main.rs && cargo build --release RUN strip target/release/mk-dl-bot # Run @@ -21,13 +23,9 @@ RUN apk add --no-cache libgcc RUN apk add --no-cache ffmpeg python3 py3-pip RUN pip install --break-system-packages yt-dlp -# Those directories are required by bot -RUN mkdir -p /var/lib/mk-dl-bot -RUN mkdir -p /var/log/mk-dl-bot - WORKDIR /app -COPY migrations ./migrations -COPY locales ./locales +COPY migrations/ ./migrations/ +COPY locales/ ./locales/ COPY --from=builder /usr/src/app/target/release/mk-dl-bot . ENTRYPOINT ["/app/mk-dl-bot"] \ No newline at end of file