Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LibreTranslate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Riße, Matthias
LibreTranslate
Commits
e8286583
Commit
e8286583
authored
2 years ago
by
Piti Cookie
Browse files
Options
Downloads
Patches
Plain Diff
Added models include option in docker build
parent
3a65bbce
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Dockerfile
+7
-3
7 additions, 3 deletions
Dockerfile
install_models.py
+6
-2
6 additions, 2 deletions
install_models.py
with
13 additions
and
5 deletions
Dockerfile
+
7
−
3
View file @
e8286583
FROM
python:3.8.12-slim-bullseye
FROM
python:3.8.12-slim-bullseye
ARG
with_models=false
ARG
with_models=false
ARG
models=
WORKDIR
/app
WORKDIR
/app
...
@@ -14,14 +15,17 @@ RUN pip install --upgrade pip
...
@@ -14,14 +15,17 @@ RUN pip install --upgrade pip
COPY
. .
COPY
. .
# check for offline build
RUN if
[
"
$with_models
"
=
"true"
]
;
then
\
RUN if
[
"
$with_models
"
=
"true"
]
;
then
\
# install only the dependencies first
# install only the dependencies first
pip install -e .; \
pip install -e .; \
# initialize the language models
# initialize the language models
./install_models.py; \
if [ ! -z "$models" ]; then \
./install_models.py --load_only_lang_codes "$models"; \
else \
./install_models.py; \
fi \
fi
fi
# Install package from source code
# Install package from source code
RUN
pip
install
.
\
RUN
pip
install
.
\
&&
pip cache purge
&&
pip cache purge
...
...
This diff is collapsed.
Click to expand it.
install_models.py
+
6
−
2
View file @
e8286583
#!/usr/bin/env python
#!/usr/bin/env python
import
argparse
from
app.init
import
check_and_install_models
,
check_and_install_transliteration
from
app.init
import
check_and_install_models
,
check_and_install_transliteration
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
check_and_install_models
(
force
=
True
)
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
--load_only_lang_codes
"
,
type
=
str
,
default
=
""
)
args
=
parser
.
parse_args
()
lang_codes
=
args
.
load_only_lang_codes
.
split
(
"
,
"
)
or
None
check_and_install_models
(
force
=
True
,
load_only_lang_codes
=
lang_codes
)
check_and_install_transliteration
(
force
=
True
)
check_and_install_transliteration
(
force
=
True
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment