Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KNIGHT
Asyst Moodle Plugin
Commits
0868c4dc
Commit
0868c4dc
authored
Dec 31, 2024
by
Artem Baranovskyi
Browse files
Image build is optimized.
parent
64c8bd9b
Pipeline
#10603
failed with stage
in 59 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
flask_ml_api/Dockerfile
View file @
0868c4dc
# 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
...
...
flask_ml_api/docker-compose.yml
View file @
0868c4dc
...
...
@@ -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"
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment