-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Builds the sdist for model-builder in docker, by copying in the .git folder so it can deduce the version. The sdist tar.gz is then copied into a new docker image for the actual serving, where it and its requirements are installed.
- Loading branch information
Showing
3 changed files
with
32 additions
and
13 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 |
---|---|---|
@@ -1,19 +1,29 @@ | ||
FROM python:3.6.6-slim-stretch | ||
FROM python:3.6.6 as builder | ||
|
||
# Copy source code | ||
COPY . /code | ||
# Copy .git to deduce version number | ||
COPY .git /code/ | ||
|
||
RUN mkdir /data | ||
WORKDIR /code | ||
RUN python setup.py sdist && \ | ||
mv /code/dist/$(ls /code/dist | head -1) /code/dist/gordo-components-packed.tar.gz | ||
|
||
FROM python:3.6.6-slim-stretch | ||
|
||
# Install requirements separately for improved docker caching | ||
COPY requirements.txt /code/ | ||
RUN pip install -r /code/requirements.txt | ||
|
||
# Copy source code | ||
COPY . /code | ||
|
||
# Install gordo-components, packaged from earlier 'python setup.py sdist' | ||
RUN pip install /code/dist/$(ls /code/dist | head -1) | ||
ADD build.sh /code/build.sh | ||
|
||
# build.sh (build the model) as executable default command | ||
RUN cp /code/build.sh /usr/bin/build \ | ||
&& chmod +x /usr/bin/build | ||
|
||
# Install gordo-components, packaged from earlier 'python setup.py sdist' | ||
COPY --from=builder /code/dist/gordo-components-packed.tar.gz . | ||
|
||
RUN pip install ./gordo-components-packed.tar.gz | ||
|
||
CMD ["build"] |
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 |
---|---|---|
@@ -1,12 +1,21 @@ | ||
FROM seldonio/seldon-core-s2i-python3 | ||
FROM python:3.6.6 as builder | ||
|
||
# Copy source code | ||
COPY . /code | ||
# Copy .git to deduce version number | ||
COPY .git /code/ | ||
|
||
RUN mkdir /code | ||
WORKDIR /code | ||
RUN python setup.py sdist && \ | ||
mv /code/dist/$(ls /code/dist | head -1) /code/dist/gordo-components-packed.tar.gz | ||
|
||
FROM seldonio/seldon-core-s2i-python3 | ||
|
||
# Install requirements separately for improved docker caching | ||
COPY requirements.txt /code/ | ||
RUN pip install -r /code/requirements.txt | ||
|
||
COPY . /code | ||
COPY --from=builder /code/dist/gordo-components-packed.tar.gz . | ||
|
||
# Install gordo-components, packaged from earlier 'python setup.py sdist' | ||
RUN pip install /code/dist/$(ls /code/dist | head -1) | ||
RUN pip install ./gordo-components-packed.tar.gz |
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