Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pado
Asyst Moodle Plugin
Commits
6db02a12
Commit
6db02a12
authored
5 months ago
by
Artem Baranovskyi
Browse files
Options
Download
Email Patches
Plain Diff
Image build is optimized.
parent
389f5769
master
Pipeline
#10884
failed with stages
in 2 minutes and 31 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+1
-18
.gitlab-ci.yml
flask_ml_api/Dockerfile
+4
-25
flask_ml_api/Dockerfile
with
5 additions
and
43 deletions
+5
-43
.gitlab-ci.yml
+
1
-
18
View file @
6db02a12
...
@@ -27,23 +27,7 @@ before_script:
...
@@ -27,23 +27,7 @@ before_script:
-
mkdir -p ~/.docker
-
mkdir -p ~/.docker
-
echo $DOCKER_CONFIG_JSON | base64 -d > ~/.docker/config.json
-
echo $DOCKER_CONFIG_JSON | base64 -d > ~/.docker/config.json
-
docker system prune -a -f --volumes ||
true
-
docker system prune -a -f --volumes ||
true
-
docker container prune -f ||
true
-
apt-get update && apt-get install -y apt-utils && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*
-
docker network prune -f ||
true
-
docker image prune -a -f ||
true
-
docker builder prune -f ||
true
-
apt-get update
-
apt-get install -y apt-utils
-
apt-get clean
-
rm -rf /var/lib/apt/lists/*
-
rm -rf /tmp/*
-
journalctl --vacuum-time=1s
after_script
:
-
docker system prune -a -f --volumes ||
true
-
docker container prune -f ||
true
-
docker network prune -f ||
true
-
docker image prune -a -f ||
true
-
docker builder prune -f ||
true
build
:
build
:
stage
:
build
stage
:
build
...
@@ -52,7 +36,6 @@ build:
...
@@ -52,7 +36,6 @@ build:
-
name
:
docker:20.10.16-dind
-
name
:
docker:20.10.16-dind
command
:
[
"
--host=tcp://docker:2375"
,
"
--tls=false"
,
"
--storage-driver=overlay2"
,
"
--mtu=1500"
,
"
--data-root=/mnt/volume"
]
command
:
[
"
--host=tcp://docker:2375"
,
"
--tls=false"
,
"
--storage-driver=overlay2"
,
"
--mtu=1500"
,
"
--data-root=/mnt/volume"
]
script
:
script
:
-
docker info
-
docker buildx create --use
-
docker buildx create --use
-
docker buildx build --cache-from=type=registry,ref=22baar1mst/asyst-nlp-grader --no-cache --progress=plain -t 22baar1mst/asyst-nlp-grader:latest -f flask_ml_api/Dockerfile .
-
docker buildx build --cache-from=type=registry,ref=22baar1mst/asyst-nlp-grader --no-cache --progress=plain -t 22baar1mst/asyst-nlp-grader:latest -f flask_ml_api/Dockerfile .
-
docker push 22baar1mst/asyst-nlp-grader:latest
-
docker push 22baar1mst/asyst-nlp-grader:latest
...
...
This diff is collapsed.
Click to expand it.
flask_ml_api/Dockerfile
+
4
-
25
View file @
6db02a12
=FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime as build
FROM
pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
as
base
RUN
apt-get update
&&
apt-get
install
-y
curl
RUN
curl
--proto
'=https'
--tlsv1
.2
-sSf
https://sh.rustup.rs
-o
/usr/local/bin/rustup-init.sh
RUN
chmod
+x /usr/local/bin/rustup-init.sh
RUN
/usr/local/bin/rustup-init.sh
-y
--default-toolchain
none
ENV
PATH="$PATH:/root/.cargo/bin"
RUN
/root/.cargo/bin/rustup toolchain
install
stable
--profile
minimal
--no-self-update
RUN
/root/.cargo/bin/rustup
--version
RUN
/root/.cargo/bin/cargo
--version
RUN
apt-get update
&&
apt-get
install
-y
--no-install-recommends
\
RUN
apt-get update
&&
apt-get
install
-y
--no-install-recommends
\
build-essential python3-venv
&&
\
build-essential python3-venv
curl
&&
\
apt-get clean
&&
\
apt-get clean
&&
\
rm
-rf
/var/lib/apt/lists/
*
rm
-rf
/var/lib/apt/lists/
*
RUN
python3
-m
venv /opt/myenv
RUN
python3
-m
venv /opt/myenv
ENV
PATH="/opt/myenv/bin:$PATH"
ENV
PATH="/opt/myenv/bin:$PATH"
WORKDIR
/app
COPY
. /app
RUN
pip
install
--no-cache-dir
Flask matplotlib scikit-learn transformers pandas sentence_transformers
&&
\
RUN
pip
install
--no-cache-dir
Flask matplotlib scikit-learn transformers pandas sentence_transformers
&&
\
pip
install
--no-cache-dir
--upgrade
setuptools wheel
&&
\
pip
install
--no-cache-dir
--upgrade
setuptools wheel
rm
-rf
/root/.cache/pip
FROM
pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime
COPY
--from=build /opt/myenv /opt/myenv
FROM
base
as
build
ENV
PATH="/opt/myenv/bin:$PATH"
WORKDIR
/app
WORKDIR
/app
COPY
. /app
COPY
. /app
...
@@ -39,5 +19,4 @@ COPY . /app
...
@@ -39,5 +19,4 @@ COPY . /app
RUN
chown
-R
www-data:www-data /app
&&
chmod
-R
755 /app
RUN
chown
-R
www-data:www-data /app
&&
chmod
-R
755 /app
EXPOSE
5000
EXPOSE
5000
CMD
["/opt/myenv/bin/python", "/app/api.py"]
CMD
["/opt/myenv/bin/python", "/app/api.py"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets