Commit 0868c4dc authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Image build is optimized.

parent 64c8bd9b
Pipeline #10603 failed with stage
in 59 seconds
# Build stage
FROM python:3.10-slim AS builder
FROM python:3.10-alpine AS builder
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
......@@ -15,14 +15,21 @@ WORKDIR /app
COPY . /app
# Install dependencies in separate steps to reduce memory usage
RUN /opt/myenv/bin/pip install torch \
&& /opt/myenv/bin/pip install Flask \
&& /opt/myenv/bin/pip install matplotlib \
&& /opt/myenv/bin/pip install scikit-learn \
&& /opt/myenv/bin/pip install transformers \
&& /opt/myenv/bin/pip install pandas \
&& /opt/myenv/bin/pip install sentence_transformers \
&& /opt/myenv/bin/python3 -m pip install --upgrade setuptools wheel
RUN /opt/myenv/bin/pip install torch && \
rm -rf /root/.cache/pip \
RUN /opt/myenv/bin/pip install Flask && \
rm -rf /root/.cache/pip
RUN /opt/myenv/bin/pip install matplotlib && \
rm -rf /root/.cache/pip
RUN /opt/myenv/bin/pip install scikit-learn && \
rm -rf /root/.cache/pip
RUN /opt/myenv/bin/pip install transformers && \
rm -rf /root/.cache/pip
RUN /opt/myenv/bin/pip install pandas && \
rm -rf /root/.cache/pip
RUN /opt/myenv/bin/pip install sentence_transformers && \
rm -rf /root/.cache/pip
RUN /opt/myenv/bin/pip install --upgrade setuptools wheel
# Final image
FROM python:3.10-slim
......
......@@ -9,6 +9,8 @@ services:
- "5001:5000"
volumes:
- .:/app
- /mnt/volume:/var/lib/docker
restart: on-failure
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:5000"]
......
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