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
7ccb36bb
Commit
7ccb36bb
authored
Jan 05, 2025
by
Artem Baranovskyi
Browse files
Image build is optimized.
parent
9f6cb339
Pipeline
#10716
failed with stages
in 8 minutes and 44 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
flask_ml_api/Dockerfile
View file @
7ccb36bb
FROM
pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
FROM
pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
# Install necessary packages
RUN
apt-get update
&&
apt-get
install
-y
--no-install-recommends
\
build-essential python3-venv
&&
\
apt-get clean
&&
\
rm
-rf
/var/lib/apt/lists/
*
# Create virtual environment and install dependencies
RUN
python3
-m
venv /opt/myenv
&&
\
/opt/myenv/bin/pip
install
--no-cache-dir
Flask matplotlib scikit-learn transformers pandas sentence_transformers
&&
\
/opt/myenv/bin/pip
install
--no-cache-dir
--upgrade
setuptools wheel
build-essential python3-venv
&&
\
apt-get clean
&&
\
rm
-rf
/var/lib/apt/lists/
*
RUN
python3
-m
venv /opt/myenv
ENV
PATH="/opt/myenv/bin:$PATH"
WORKDIR
/app
COPY
. /app
RUN
sudo
docker system prune
-a
-f
--volumes
RUN
sudo
docker container prune
-f
RUN
sudo
docker network prune
-f
RUN
sudo
docker image prune
-a
-f
RUN
sudo
docker builder prune
-f
RUN
sudo
apt-get clean
RUN
sudo rm
-rf
/var/lib/apt/lists/
*
RUN
sudo rm
-rf
/tmp/
*
RUN
sudo
journalctl
--vacuum-time
=
1s
RUN
df
-h
RUN
sudo
docker builder prune
-f
# Setting permissions and cleaning
RUN
pip
install
--no-cache-dir
Flask matplotlib scikit-learn transformers pandas sentence_transformers
&&
\
pip
install
--no-cache-dir
--upgrade
setuptools wheel
RUN
rm
-rf
/root/.cache/pip
# Настройка прав
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"]
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