-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6afca1e
commit b12ed29
Showing
3 changed files
with
29 additions
and
17 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,26 +1,40 @@ | ||
FROM continuumio/miniconda3 | ||
RUN apt-get update && apt-get install -y build-essential | ||
|
||
ENV PYTHONIOENCODING=utf-8 | ||
VOLUME /app/models | ||
FROM continuumio/miniconda3 as build | ||
RUN apt-get update && \ | ||
apt-get install -y build-essential && \ | ||
conda install -c conda-forge conda-pack mamba | ||
|
||
COPY environments/environment.yml . | ||
RUN conda env create -f environment.yml -n nmt && rm environment.yml | ||
SHELL ["conda", "run", "-n", "nmt", "/bin/bash", "-c"] | ||
RUN python -c "import nltk; nltk.download(\"punkt\"); nltk.download(\"cmudict\")" | ||
RUN pip install sockeye==1.18.106 --no-deps | ||
SHELL ["/bin/bash", "-c"] | ||
RUN mamba env create -f environment.yml -n venv && \ | ||
rm environment.yml && \ | ||
conda run -n venv pip install --no-deps sockeye==1.18.106 && \ | ||
conda-pack -n venv -o /tmp/env.tar && \ | ||
mkdir /venv && \ | ||
cd /venv && \ | ||
tar xf /tmp/env.tar && \ | ||
rm /tmp/env.tar && \ | ||
/venv/bin/conda-unpack && \ | ||
conda clean -afy && \ | ||
find /opt/conda/ -follow -type f -name '*.a' -delete && \ | ||
find /opt/conda/ -follow -type f -name '*.pyc' -delete && \ | ||
find /opt/conda/ -follow -type f -name '*.js.map' -delete && \ | ||
conda env remove -n venv | ||
|
||
FROM debian:buster | ||
|
||
ENV PYTHONIOENCODING=utf-8 | ||
WORKDIR /app | ||
RUN adduser --disabled-password --gecos "app" app && \ | ||
chown -R app:app /app && \ | ||
chown -R app:app /opt/conda/envs/nmt | ||
VOLUME /app/models | ||
|
||
RUN adduser --disabled-password --gecos "app" app && \ | ||
chown -R app:app /app | ||
USER app | ||
|
||
COPY --from=build --chown=app:app /venv /venv | ||
ENV PATH="/venv/bin:${PATH}" | ||
COPY --chown=app:app . . | ||
|
||
ENV WORKER_NAME="" | ||
RUN python -c "import nltk; nltk.download(\"punkt\")"; | ||
|
||
RUN echo "python nmt_worker.py --worker \$WORKER_NAME" > entrypoint.sh | ||
|
||
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "nmt", "bash", "entrypoint.sh"] | ||
ENTRYPOINT ["bash", "entrypoint.sh"] |
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