mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 06:55:37 +01:00
Add rust implementation
This commit is contained in:
21
docker/build-dev.dockerfile
Normal file
21
docker/build-dev.dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM rust:bullseye AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cargo build --bin books_downloader
|
||||
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y openssl ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN update-ca-certificates
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/target/debug/books_downloader /usr/local/bin
|
||||
ENTRYPOINT ["/usr/local/bin/books_downloader"]
|
||||
@@ -1,26 +1,21 @@
|
||||
FROM ghcr.io/flibusta-apps/base_docker_images:3.11-poetry-buildtime as build-image
|
||||
FROM rust:bullseye AS builder
|
||||
|
||||
WORKDIR /root/poetry
|
||||
COPY pyproject.toml poetry.lock /root/poetry/
|
||||
WORKDIR /app
|
||||
|
||||
ENV VENV_PATH=/opt/venv
|
||||
COPY . .
|
||||
|
||||
RUN poetry export --without-hashes > requirements.txt \
|
||||
&& . /opt/venv/bin/activate \
|
||||
&& pip install -r requirements.txt --no-cache-dir
|
||||
RUN cargo build --release --bin books_downloader
|
||||
|
||||
|
||||
FROM python:3.11-slim as runtime-image
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
ENV VENV_PATH=/opt/venv
|
||||
ENV PATH="$VENV_PATH/bin:$PATH"
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y openssl ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ./src/ /app/
|
||||
COPY ./scripts/* /root/
|
||||
COPY --from=build-image $VENV_PATH $VENV_PATH
|
||||
RUN update-ca-certificates
|
||||
|
||||
EXPOSE 8080
|
||||
WORKDIR /app
|
||||
|
||||
WORKDIR /app/
|
||||
|
||||
CMD bash /root/start.sh
|
||||
COPY --from=builder /app/target/release/books_downloader /usr/local/bin
|
||||
ENTRYPOINT ["/usr/local/bin/books_downloader"]
|
||||
|
||||
Reference in New Issue
Block a user