mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
Update image building
This commit is contained in:
@@ -1,38 +1,26 @@
|
|||||||
FROM python:3.10-slim as build-image
|
FROM ghcr.io/kurbezz/base_docker_images:3.10-postgres-asyncpg-poetry-buildtime as build-image
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install --no-install-recommends -y gcc build-essential python3-dev libpq-dev libffi-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
WORKDIR /root/poetry
|
WORKDIR /root/poetry
|
||||||
COPY pyproject.toml poetry.lock /root/poetry/
|
COPY pyproject.toml poetry.lock /root/poetry/
|
||||||
|
|
||||||
RUN pip install poetry wheel --no-cache-dir \
|
|
||||||
&& poetry export --without-hashes > requirements.txt
|
|
||||||
|
|
||||||
ENV VENV_PATH=/opt/venv
|
ENV VENV_PATH=/opt/venv
|
||||||
|
|
||||||
RUN python -m venv $VENV_PATH \
|
RUN poetry export --without-hashes > requirements.txt \
|
||||||
&& . /opt/venv/bin/activate \
|
&& . /opt/venv/bin/activate \
|
||||||
&& pip install -r requirements.txt --no-cache-dir
|
&& pip install -r requirements.txt --no-cache-dir
|
||||||
|
|
||||||
|
|
||||||
FROM python:3.10-slim as runtime-image
|
FROM ghcr.io/kurbezz/base_docker_images:3.10-postgres-runtime as runtime-image
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install --no-install-recommends -y python3-dev libpq-dev libffi-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ./fastapi_book_server/ /app/
|
|
||||||
|
|
||||||
ENV VENV_PATH=/opt/venv
|
ENV VENV_PATH=/opt/venv
|
||||||
COPY --from=build-image $VENV_PATH $VENV_PATH
|
|
||||||
ENV PATH="$VENV_PATH/bin:$PATH"
|
ENV PATH="$VENV_PATH/bin:$PATH"
|
||||||
|
|
||||||
COPY ./scripts/start.sh /root/
|
COPY ./fastapi_book_server/ /app/
|
||||||
COPY ./scripts/healthcheck.py /root/
|
COPY ./scripts/* /root/
|
||||||
|
|
||||||
|
COPY --from=build-image $VENV_PATH $VENV_PATH
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user