Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
spacy-server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
spacy-server
Commits
5106f041
Commit
5106f041
authored
Dec 16, 2019
by
neelkamath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Docker builds
parent
96af1f80
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
14 deletions
+25
-14
Dockerfile
docker/Dockerfile
+2
-2
deploy.sh
scripts/deploy.sh
+23
-11
setup.sh
scripts/setup.sh
+0
-1
No files found.
docker/Dockerfile
View file @
5106f041
...
...
@@ -5,13 +5,13 @@ RUN pip install --no-cache-dir -r requirements.txt
ARG
SPACY_MODEL
ENV
PYTHONBUFFERED=1 SENSE2VEC=0 SPACY_MODEL=$SPACY_MODEL
RUN
python
-m
spacy download
$SPACY_MODEL
COPY
src/main.py
.
COPY
src/main.py
src/main.py
EXPOSE
8000
HEALTHCHECK
--timeout=2s --start-period=2s --retries=1 \
CMD curl -f http://localhost:8000/health_check
RUN
useradd user
USER
user
CMD
["uvicorn", "main:app", "--host", "0.0.0.0"]
CMD
["uvicorn", "
src.
main:app", "--host", "0.0.0.0"]
FROM
base
ENV
SENSE2VEC 1
...
...
scripts/deploy.sh
View file @
5106f041
#!/usr/bin/env sh
# Builds and uploads every image (e.g., neelkamath/spacy-server:2-en_core_web_sm-sense2vec) to Docker Hub.
# Builds and deploys an image. Pass the version, spaCy model, and whether to delete the pushed images as arguments.
deploy
()
{
base_tag
=
"
$DOCKER_HUB_USER
"
/spacy-server:
"
$1
"
-
"
$2
"
sense2vec_tag
=
"
$base_tag
"
-sense2vec
docker build
--target
base
--build-arg
SPACY_MODEL
=
"
$2
"
-t
"
$base_tag
"
-f
docker/Dockerfile
.
docker build
--build-arg
SPACY_MODEL
=
"
$2
"
-t
"
$sense2vec_tag
"
-f
docker/Dockerfile
.
docker push
"
$base_tag
"
docker push
"
$sense2vec_tag
"
if
[
"
$3
"
=
1
]
then
docker rmi
"
$base_tag
"
"
$sense2vec_tag
"
fi
}
# Get the HTTP API version.
version
=
$(
grep
version docs/openapi.yaml
-m
1
)
version
=
${
version
#*
:
}
...
...
@@ -10,13 +23,12 @@ version=$(echo "$version" | cut -d "'" -f 2)
# Log in.
echo
"
$DOCKER_HUB_PASSWORD
"
| docker login
-u
"
$DOCKER_HUB_USER
"
--password-stdin
https://index.docker.io/v1/
# Build and upload the images.
while
IFS
=
''
read
-r
spacy_model
||
[
-n
"
$spacy_model
"
]
;
do
base_tag
=
"
$DOCKER_HUB_USER
"
/spacy-server:
"
$version
"
-
"
$spacy_model
"
sense2vec_tag
=
"
$base_tag
"
-sense2vec
docker build
--target
base
--build-arg
SPACY_MODEL
=
"
$spacy_model
"
-t
"
$base_tag
"
-f
docker/Dockerfile
.
docker build
--build-arg
SPACY_MODEL
=
"
$spacy_model
"
-t
"
$sense2vec_tag
"
-f
docker/Dockerfile
.
docker push
"
$base_tag
"
docker push
"
$sense2vec_tag
"
docker rmi
"
$base_tag
"
"
$sense2vec_tag
"
# Prevent the device (e.g., CI runner) from running out of space and crashing.
done
<scripts/models.txt
# Build and upload images. We prevent the device (e.g., CI runner) from running out of space and crashing by deleting
# images after they've been pushed. We don't delete the first image so that subsequent builds can use its cache.
deploy
"
$version
"
"
$(
head
-n
1 scripts/models.txt
)
"
0
# Don't delete the first image.
{
read
-r
# Skip the first line because we've already deployed it.
while
IFS
=
''
read
-r
spacy_model
||
[
-n
"
$spacy_model
"
]
;
do
deploy
"
$version
"
"
$spacy_model
"
1
done
}
<scripts/models.txt
\ No newline at end of file
scripts/setup.sh
View file @
5106f041
#!/usr/bin/env sh
# Sets up the development environment.
python
-m
venv venv
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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