feature: try to add poetry build

This commit is contained in:
winkidney
2022-05-04 18:42:56 +08:00
parent 132cc96893
commit 00004fea1d

View File

@@ -24,10 +24,17 @@ RUN yarn build
FROM python:3.9.12-slim-buster as base
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR pinry
RUN apt-get update \
&& if [ $(dpkg --print-architecture) = "arm64" -o $(dpkg --print-architecture) = "armhf" ]; then apt-get -y install apt-utils; fi \
&& apt-get -y install gcc default-libmysqlclient-dev
RUN pip --no-cache-dir install --user mysqlclient cx-Oracle
# Install Poetry requirements
COPY pyproject.toml ./
COPY poetry.lock ./
RUN pip install poetry \
&& poetry run pip install mysqlclient cx-Oracle \
&& poetry run pip install "rcssmin==1.0.6" --install-option="--without-c-extensions" \
&& poetry install
# Final image
@@ -55,17 +62,11 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoclean
# Install Poetry requirements
COPY pyproject.toml ./
COPY poetry.lock ./
RUN pip install "rcssmin==1.0.6" --install-option="--without-c-extensions" \
&& pip install poetry \
&& poetry install
RUN pip install --no-cache-dir poetry
# Copy from previous stages
COPY --from=yarn-build pinry-spa/dist /pinry/pinry-spa/dist
COPY --from=base /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
COPY --from=base /root/.cache/pypoetry /root/.cache/pypoetry
COPY . .