-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from fako/docker
Docker
- Loading branch information
Showing
503 changed files
with
1,299 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
data/ | ||
postgres/ | ||
redis/ | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POSTGRES_PASSWORD=33SebQd4Ugkqx4KjqanZDsWRXTR54M6k | ||
DJANGO_POSTGRES_PASSWORD=ZV35A5x89pbHuiYSrvqroPHKDnng7dRF | ||
DS_DATA_DIR=./data | ||
DJANGO_MODE=development | ||
INVOKE_DJANGO_DEBUG=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM python:3.6 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y vim binutils libproj-dev gdal-bin gettext default-jdk | ||
|
||
# Setup directories, 3rd party models and users | ||
RUN mkdir -p /usr/etc/datascope | ||
COPY deploy/environments /usr/etc/datascope | ||
RUN mkdir -p /usr/etc/models | ||
COPY models /usr/etc/models | ||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
RUN useradd -ms /bin/bash app | ||
|
||
# Install Python dependencies and copy app | ||
RUN pip install --upgrade pip | ||
COPY src/datascope/requirements /usr/src/app/datascope/requirements | ||
RUN pip install --no-cache-dir -r datascope/requirements/production.txt | ||
COPY --chown=app:app src /usr/src/app | ||
|
||
# We setup spaCy models outside of the pip flow to prevent repetious downloads | ||
RUN python -m spacy link /usr/etc/models/spacy/en_core_web_lg-2.0.0/en_core_web_lg en_core_web_lg | ||
RUN python -m spacy link /usr/etc/models/spacy/nl_core_news_sm-2.0.0/nl_core_news_sm nl_core_news_sm | ||
|
||
# We're serving static files through Whitenoise | ||
# See: http://whitenoise.evans.io/en/stable/index.html# | ||
# If you doubt this decision then read the "infrequently asked question" section for details | ||
# Here we gather static files that get served through uWSGI | ||
# NB: runs with production settings | ||
RUN python manage.py collectstatic --noinput | ||
|
||
# We're switching user to a non-priviliged user | ||
# The Python packages directory and datagrowth package needs to belong to that user | ||
# for dynamic packaging (see entrypoint) | ||
RUN chown app:app /usr/local/lib/python3.6/site-packages | ||
RUN chown -R app:app /usr/local/lib/python3.6/site-packages/datagrowth* | ||
USER app:app | ||
|
||
# Compiling translations | ||
# NB: runs with production settings | ||
# NB: not enabled | ||
# RUN python manage.py compilemessages | ||
|
||
# Entrypoint handles some edge cases before running | ||
ENTRYPOINT ["/usr/src/app/entrypoint.sh"] | ||
|
||
# The default command is to start a uWSGI server | ||
CMD ["uwsgi", "--ini", "/usr/src/app/uwsgi.ini"] | ||
|
||
# EXPOSE port 8000 to allow communication to/from server | ||
EXPOSE 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
source venv/bin/activate | ||
export DJANGO_CONTEXT=host | ||
export $(cat .env | xargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from invoke import task | ||
from src.datascope.version import get_project_version | ||
|
||
|
||
REPOSITORY = "eu.gcr.io/datascope-266618" | ||
|
||
|
||
@task() | ||
def container(ctx, version=None): | ||
|
||
if not version: | ||
version = get_project_version("src/package.json") | ||
|
||
print(f"Building: {version}") | ||
tag = f"{REPOSITORY}/datascope:{version}" | ||
rsl = ctx.run( | ||
f"docker build . -t {tag}", | ||
echo=True | ||
) | ||
|
||
if rsl.failed: | ||
print(rsl.stderr) | ||
raise RuntimeError("Failed to build docker image") | ||
|
||
print("Pushing") | ||
rsl = ctx.run( | ||
"docker push {}".format(tag), | ||
echo=True, | ||
pty=True | ||
) | ||
|
||
if rsl.failed: | ||
print(rsl.stderr) | ||
raise RuntimeError("Failed to push image tagged {}".format(tag)) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.