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
ac65d5ad
Commit
ac65d5ad
authored
Dec 15, 2024
by
Artem Baranovskyi
Browse files
Image build is optimized.
parent
0de22e92
Changes
2
Hide whitespace changes
Inline
Side-by-side
deploy_backend.sh
View file @
ac65d5ad
...
...
@@ -14,4 +14,4 @@ cd "$BACKEND_PATH" || {
docker-compose up
-d
--build
# Message about successful deployment
echo
"Flask-бекенд развернут и запущен."
\ No newline at end of file
echo
"Flask NLP backend is up and running."
\ No newline at end of file
flask_ml_api/Dockerfile
View file @
ac65d5ad
FROM
python:3.11-slim
# Build stage
FROM
python:3.10-slim
AS
builder
# Install
ing
system dependencies
# Install system dependencies
RUN
apt-get update
&&
apt-get
install
-y
--no-install-recommends
\
build-essential
\
python3-venv
\
curl
\
&&
rm
-rf
/var/lib/apt/lists/
*
# Creat
ing
and activat
ing th
e virtual environment
\
# Creat
e
and activate virtual environment
RUN
python3
-m
venv /opt/myenv
ENV
PATH="/opt/myenv/bin:$PATH"
WORKDIR
/app
COPY
. /app
COPY
./asyst /app/asyst
COPY
requirements.txt .
# Install
ing
dependencies
RUN
/opt/myenv/bin/pip
install
-r
/app/requirements.txt
RUN
/opt/myenv/bin/python3
-m
pip
install
--upgrade
setuptools wheel
# Install dependencies
RUN
/opt/myenv/bin/pip
install
-r
/app/requirements.txt
\
&&
/opt/myenv/bin/python3
-m
pip
install
--upgrade
setuptools wheel
# Final image
FROM
python:3.10-slim
# Install system dependencies
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
COPY
--from=builder /app /app
# Activate virtual environment in the final image
ENV
PATH="/opt/myenv/bin:$PATH"
# Set permissions
RUN
chown
-R
www-data:www-data /app/asyst
RUN
chmod
-R
755 /app/asyst
RUN
chown
-R
www-data:www-data /app/asyst
\
&&
chmod
-R
755 /app/asyst
#
Open
port for Flask API
#
Expose
port for Flask API
EXPOSE
5000
# Launch application
CMD
["python", "/app/api.py"]
\ No newline at end of file
# Run the application
CMD
["/opt/myenv/bin/python", "/app/api.py"]
\ No newline at end of file
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