Skip to content

Commit

Permalink
Checkin docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
thammegowda committed Oct 19, 2022
1 parent 141ee5d commit 70d0661
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 3 deletions.
45 changes: 45 additions & 0 deletions dockers/rtg-0.7.1-ub20.04-py3.9_tr1.10_cu11.4.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# What is this: USC ISI Coral team's MT pipeline
# Authors:
# - Thamme Gowda
# Created : Oct 20, 2020

# build instr https://www.docker.com/blog/multi-arch-images/

#FROM nvidia/cuda:10.2-devel-ubuntu18.04
#FROM nvidia/cuda:11.1-devel-ubuntu20.04
FROM nvidia/cuda:11.4.0-runtime-ubuntu20.04

# suppress prompts https://stackoverflow.com/a/67452950/1506477
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update \
&& apt install -y curl python3.9 python3-pip python3.9-dev \
build-essential git locales locales-all \
&& apt-get autoremove --purge

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

# Update pip
RUN ln -s /usr/bin/python3.9 /usr/bin/python && python -m pip install --upgrade pip

#Make non-root user;
RUN useradd --create-home rtguser
#RUN chown -Rv rtguser:rtguser /home/rtguser

WORKDIR /home/rtguser
USER rtguser

# pip installed bins go here, they needs to be in PATH
RUN mkdir -p /home/rtguser/.local/bin /home/rtguser/rtg
ENV CUDA_HOME="/usr/local/cuda/"
ENV PATH="/home/rtguser/.local/bin:/usr/local/cuda/bin:${PATH}"

#COPY --chown=rtguser:rtguser . /home/rtguser/rtg/
# && cd /home/rtguser/rtg && pip install --editable . \

RUN pip install --user torch==1.12 flask==2.1 uwsgi rtg==0.7.1 \
&& pip cache purge

CMD bash

17 changes: 17 additions & 0 deletions dockers/rtg-model-0.7.1-600toEng-v2.0.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# What is this: USC ISI Coral team's MT pipeline
# Authors:
# - Thamme Gowda
# Created : March 15, 2022

FROM tgowda/rtg:0.7.1-ub20.04-py3.9_tr1.10_cu11.4
# Download pretrained model from rtg demo website

RUN cd /home/rtguser/ && \
curl -O http://rtg.isi.edu/many-eng/models/many-eng-v2.0-rtg600eng1024d_ful74k.tgz && \
tar xvf many-eng-v2.0-rtg600eng1024d_ful74k.tgz --one-top-level=many-eng-v2.0-600toeng --strip-components 1 && \
rm *.tgz

#CMD rtg-serve /home/rtguser/
#CMD python -m rtg.serve /home/rtguser/many-eng-v2.0-600toeng
CMD uwsgi --http 0.0.0.0:6060 --module rtg.serve.app:app --pyargv "/home/rtguser/many-eng-v2.0-600toeng"

47 changes: 47 additions & 0 deletions dockers/rtg-model-arm64cpu-0.7-600toEng-v2.0.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# RTG docker, without cuda, for arm64 cpu such as Apple silicon, Qualcomm snapdragon, Microsoft SQ etc
# Authors:
# - Thamme Gowda
# Created : March 15, 2022
FROM ubuntu:22.04

# suppress prompts https://stackoverflow.com/a/67452950/1506477
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update \
&& apt install -y curl python3.9 python3-pip python3.9-dev \
build-essential git locales locales-all \
&& apt-get autoremove --purge

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

# Update pip
RUN ln -s /usr/bin/python3.9 /usr/bin/python && python -m pip install --upgrade pip

#Make non-root user;
RUN useradd --create-home rtguser
#RUN chown -Rv rtguser:rtguser /home/rtguser

WORKDIR /home/rtguser
USER rtguser

# pip installed bins go here, they needs to be in PATH
RUN mkdir -p /home/rtguser/.local/bin /home/rtguser/rtg
ENV PATH="/home/rtguser/.local/bin:${PATH}"

#COPY --chown=rtguser:rtguser . /home/rtguser/rtg/
# && cd /home/rtguser/rtg && pip install --editable . \

RUN pip install --user torch==1.10.2 flask==2.0.3 uwsgi rtg==0.7 setuptools==59.5.0 && pip cache purge

CMD bash

RUN cd /home/rtguser/ && \
curl -O http://rtg.isi.edu/many-eng/models/many-eng-v2.0-rtg600eng1024d_ful74k.tgz && \
tar xvf many-eng-v2.0-rtg600eng1024d_ful74k.tgz --one-top-level=many-eng-v2.0-600toeng --strip-components 1 && \
rm *.tgz

#CMD rtg-serve /home/rtguser/
#CMD python -m rtg.serve /home/rtguser/many-eng-v2.0-600toeng
CMD uwsgi --http 0.0.0.0:6060 --module rtg.serve.app:app --pyargv "/home/rtguser/many-eng-v2.0-600toeng"

18 changes: 15 additions & 3 deletions docs/howto-release.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,26 @@ For the first time users of PyPI, you need to create an account at https://pypi.
== Docker Release


=== Docker for ARM64
With Apple moving to ARM chips, running x64/AMD64 docker images on ARM64/AARCH64 is not efficient,
Follow instructions at https://www.docker.com/blog/multi-arch-images/ to build multi-arch images.

With Apple moving to ARM chips, running AMD64 docker images on ARM is not efficient.
.Docker setup
[source,bash]
----
docker buildx ls
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
# You should see in ouput: Platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6
----

[source,bash]
----
cd dockers
# find a suitable docker file to build; e.g., this one
docker build . -f rtg-0.7-py39_tr110_cu114.dockerfile-t tgowda/rtg:0.7-py39_tr110_cu114
docker buildx build --platform linux/amd64,linux/arm64 . -f rtg-0.7-py39_tr110_cu114.dockerfile-t tgowda/rtg:0.7-py39_tr110_cu114 --push
----



0 comments on commit 70d0661

Please sign in to comment.