-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker fix: Install cargo before installing pip packages
- Loading branch information
1 parent
ebffc4e
commit ab87b6f
Showing
1 changed file
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,37 @@ | ||
FROM python:3.10-slim-buster as builder | ||
|
||
# Install build essentials and Rust | ||
RUN apt-get update \ | ||
&& apt-get install -y build-essential \ | ||
&& apt-get install -y build-essential curl \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
|
||
# Add Cargo to PATH | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
||
COPY requirements.txt . | ||
COPY requirements_advanced.txt . | ||
RUN pip install --user --no-cache-dir -r requirements.txt | ||
# RUN pip install --user --no-cache-dir -r requirements_advanced.txt | ||
|
||
FROM python:3.10-slim-buster | ||
LABEL maintainer="iskoldt" | ||
|
||
# Copy Rust and Cargo from builder | ||
COPY --from=builder /root/.cargo /root/.cargo | ||
COPY --from=builder /root/.rustup /root/.rustup | ||
|
||
# Copy Python packages from builder | ||
COPY --from=builder /root/.local /root/.local | ||
ENV PATH=/root/.local/bin:$PATH | ||
|
||
# Set up environment | ||
ENV PATH=/root/.local/bin:/root/.cargo/bin:$PATH | ||
ENV RUSTUP_HOME=/root/.rustup | ||
ENV CARGO_HOME=/root/.cargo | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
ENV dockerrun=yes | ||
CMD ["python3", "-u", "ChuanhuChatbot.py","2>&1", "|", "tee", "/var/log/application.log"] | ||
EXPOSE 7860 | ||
EXPOSE 7860 |