Fix building

This commit is contained in:
2023-08-11 22:23:58 +02:00
parent 09c71b67b1
commit 80321b9e69
2 changed files with 16 additions and 30 deletions

View File

@@ -1,29 +1,21 @@
FROM ghcr.io/flibusta-apps/base_docker_images:3.11-postgres-asyncpg-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.11-postgres-runtime AS runtime-image
FROM rust:bullseye AS builder
WORKDIR /app
ENV VENV_PATH=/opt/venv
ENV PATH="$VENV_PATH/bin:$PATH"
COPY . .
COPY ./fastapi_book_server/ /app/
COPY ./scripts/* /root/
RUN cargo build --release --bin book_library_server
COPY --from=build-image $VENV_PATH $VENV_PATH
EXPOSE 8080
FROM debian:bullseye-slim
HEALTHCHECK CMD python3 /root/healthcheck.py
RUN apt-get update \
&& apt-get install -y openssl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
CMD bash /root/start.sh
RUN update-ca-certificates
WORKDIR /app
COPY --from=builder /app/target/release/book_library_server /usr/local/bin
ENTRYPOINT ["/usr/local/bin/book_library_server"]