Commit 8d3941a6 authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Image build is optimized.

parent 875b282c
Pipeline #10607 failed with stage
in 52 seconds
# Build stage
FROM python:3.10-alpine AS builder
FROM python:3.10-slim AS builder
# Install system dependencies
RUN apk add --no-cache \
......@@ -15,8 +15,7 @@ WORKDIR /app
COPY . /app
# Install dependencies in separate steps to reduce memory usage
RUN apk add --no-cache gcompat
RUN /opt/myenv/bin/pip install torch --index-url https://download.pytorch.org/whl/cpu && \
RUN /opt/myenv/bin/pip install torch && \
rm -rf /root/.cache/pip \
RUN /opt/myenv/bin/pip install Flask && \
rm -rf /root/.cache/pip
......@@ -33,10 +32,11 @@ RUN /opt/myenv/bin/pip install sentence_transformers && \
RUN /opt/myenv/bin/pip install --upgrade setuptools wheel
# Final image
FROM python:3.10-alpine
FROM python:3.10-slim
# Install system dependencies
RUN apk add --no-cache
RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Copy virtual environment and application from build stage
COPY --from=builder /opt/myenv /opt/myenv
......
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