Add pagination and build.dockerfile

This commit is contained in:
2021-12-03 23:27:20 +03:00
parent 27f35df97a
commit 19cc8b5eea
4 changed files with 45 additions and 4 deletions

35
docker/build.dockerfile Normal file
View File

@@ -0,0 +1,35 @@
FROM python:3.10-slim 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/venv
COPY ./requirements.txt /root/venv/
ENV VENV_PATH=/opt/venv
RUN python -m venv $VENV_PATH \
&& . /opt/venv/bin/activate \
&& pip install -r requirements.txt --no-cache-dir
FROM python:3.10-slim 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
COPY ./src/ /app/
ENV VENV_PATH=/opt/venv
COPY --from=build-image $VENV_PATH $VENV_PATH
ENV PATH="$VENV_PATH/bin:$PATH"
COPY ./scripts/start_production.sh /root/
EXPOSE 8080
CMD bash /root/start_production.sh