Rewrite to rust

Co-authored-by: Kurbanov Bulat <kurbanovbul@gmail.com>
This commit is contained in:
Шатунов Антон
2024-05-06 23:04:24 +03:00
parent c52950e937
commit 26de50da3a
28 changed files with 3044 additions and 1681 deletions

View File

@@ -1,32 +1,24 @@
FROM ghcr.io/flibusta-apps/base_docker_images:3.12-poetry-buildtime AS build-image
WORKDIR /root/poetry
COPY pyproject.toml poetry.lock /root/poetry/
ENV VENV_PATH=/opt/venv
RUN poetry export --without-hashes > requirements.txt \
&& . /opt/venv/bin/activate \
&& pip install -r requirements.txt --no-cache-dir
FROM ghcr.io/flibusta-apps/base_docker_images:3.12-postgres-runtime AS runtime-image
RUN apt-get update \
&& apt-get install -y curl jq \
&& rm -rf /var/lib/apt/lists/*
FROM rust:bullseye AS builder
WORKDIR /app
ENV VENV_PATH=/opt/venv
ENV PATH="$VENV_PATH/bin:$PATH"
COPY . .
COPY --from=build-image $VENV_PATH $VENV_PATH
COPY ./fastapi_file_server/ /app/
RUN cargo build --release --bin telegram_files_server
COPY ./scripts/* /
FROM debian:bullseye-slim
RUN apt-get update \
&& apt-get install -y openssl ca-certificates curl jq \
&& rm -rf /var/lib/apt/lists/*
RUN update-ca-certificates
COPY ./scripts/*.sh /
RUN chmod +x /*.sh
EXPOSE 8080
WORKDIR /app
CMD ["/start.sh"]
COPY --from=builder /app/target/release/telegram_files_server /usr/local/bin
ENTRYPOINT ["/start.sh"]