Commit ed62dd73 authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Image build is optimized.

parent bdb6fce7
No related merge requests found
Pipeline #10765 failed with stages
in 46 seconds
Showing with 10 additions and 1 deletion
+10 -1
......@@ -31,6 +31,8 @@ before_script:
- docker network prune -f || true
- docker image prune -a -f || true
- docker builder prune -f || true
- apt-get update
- apt-get install -y apt-utils
- apt-get clean
- rm -rf /var/lib/apt/lists/*
- rm -rf /tmp/*
......
# Этап сборки
FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime as build
# Установка Rust и Cargo
RUN apt-get update && apt-get install -y curl
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o /usr/local/bin/rustup-init.sh
RUN chmod +x /usr/local/bin/rustup-init.sh
RUN /usr/local/bin/rustup-init.sh -y --default-toolchain none
# Добавление пути к rustup и cargo в переменную окружения PATH
ENV PATH="$PATH:/root/.cargo/bin"
# Установка toolchain
RUN /root/.cargo/bin/rustup toolchain install stable --profile minimal --no-self-update
# Проверка установки Rust и Cargo
RUN /root/.cargo/bin/rustup --version
RUN /root/.cargo/bin/cargo --version
......@@ -23,10 +28,12 @@ ENV PATH="/opt/myenv/bin:$PATH"
WORKDIR /app
COPY . /app
# Установка пакетов Python
RUN pip install --no-cache-dir Flask matplotlib scikit-learn transformers pandas sentence_transformers && \
pip install --no-cache-dir --upgrade setuptools wheel && \
rm -rf /root/.cache/pip
# Этап финального образа
FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime
COPY --from=build /opt/myenv /opt/myenv
......@@ -40,4 +47,4 @@ RUN chown -R www-data:www-data /app && chmod -R 755 /app
EXPOSE 5000
CMD ["/opt/myenv/bin/python", "/app/api.py"]
\ No newline at end of file
CMD ["/opt/myenv/bin/python", "/app/api.py"]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment