Commit 53b401f1 authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Image build is optimized.

parent 2dc841d4
Pipeline #10600 failed with stage
in 4 minutes and 51 seconds
...@@ -24,9 +24,10 @@ build: ...@@ -24,9 +24,10 @@ build:
- docker:24-dind - docker:24-dind
before_script: before_script:
- export DOCKER_TMPDIR=/mnt/volume - export DOCKER_TMPDIR=/mnt/volume
- docker system prune -a -f
- df -h
script: script:
- docker build --no-cache --pull --progress=plain -t flask-backend-full -f flask_ml_api/Dockerfile . - docker build --no-cache --pull --progress=plain -t flask-backend-full -f flask_ml_api/Dockerfile .
# - docker build --no-cache --pull --progress=plain -t flask-backend-test -f flask_ml_api/Dockerfile.test .
cache: cache:
key: build-cache key: build-cache
......
...@@ -13,17 +13,16 @@ ENV PATH="/opt/myenv/bin:$PATH" ...@@ -13,17 +13,16 @@ ENV PATH="/opt/myenv/bin:$PATH"
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
#COPY ./asyst /app/asyst
# Install dependencies in separate steps to reduce memory usage # Install dependencies in separate steps to reduce memory usage
RUN /opt/myenv/bin/pip install torch RUN /opt/myenv/bin/pip install torch \
RUN /opt/myenv/bin/pip install Flask && /opt/myenv/bin/pip install Flask \
RUN /opt/myenv/bin/pip install matplotlib && /opt/myenv/bin/pip install matplotlib \
RUN /opt/myenv/bin/pip install scikit-learn && /opt/myenv/bin/pip install scikit-learn \
RUN /opt/myenv/bin/pip install transformers && /opt/myenv/bin/pip install transformers \
RUN /opt/myenv/bin/pip install pandas && /opt/myenv/bin/pip install pandas \
RUN /opt/myenv/bin/pip install sentence_transformers && /opt/myenv/bin/pip install sentence_transformers \
RUN /opt/myenv/bin/python3 -m pip install --upgrade setuptools wheel && /opt/myenv/bin/python3 -m pip install --upgrade setuptools wheel
# Final image # Final image
FROM python:3.10-slim FROM python:3.10-slim
...@@ -47,4 +46,4 @@ RUN chown -R www-data:www-data /app/asyst \ ...@@ -47,4 +46,4 @@ RUN chown -R www-data:www-data /app/asyst \
EXPOSE 5000 EXPOSE 5000
# Run the application # Run the application
CMD ["/opt/myenv/bin/python", "/app/api.py"] CMD ["/opt/myenv/bin/python", "/app/api.py"]
\ No newline at end of file
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