|
| 1 | +# Copyright 2020 The KNIX Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +#FROM ubuntu:18.04 |
| 16 | +FROM nvidia/cuda:10.1-cudnn-devel-ubuntu18.04 |
| 17 | + |
| 18 | +# Install (as root) |
| 19 | +# Base |
| 20 | +RUN apt-get update --fix-missing |
| 21 | +RUN apt-get -y --no-install-recommends install build-essential |
| 22 | +RUN apt-get -y --no-install-recommends install netbase unzip file libmagic1 |
| 23 | + |
| 24 | +# Python |
| 25 | +RUN apt-get -y --no-install-recommends install python3 python3-dev |
| 26 | +RUN apt-get -y --no-install-recommends install python3-pip |
| 27 | +RUN apt-get -y --no-install-recommends install zlib1g libssl1.0 libsasl2-2 ca-certificates |
| 28 | + |
| 29 | +RUN /usr/bin/python3 -m pip install --upgrade pip |
| 30 | + |
| 31 | +RUN /usr/bin/python3 -m pip install setuptools |
| 32 | +RUN /usr/bin/python3 -m pip install thrift>=0.12.0 |
| 33 | +RUN /usr/bin/python3 -m pip install anytree |
| 34 | +RUN /usr/bin/python3 -m pip install ujsonpath |
| 35 | +RUN /usr/bin/python3 -m pip install requests |
| 36 | +RUN /usr/bin/python3 -m pip install retry |
| 37 | +# remove warnings from anytree package |
| 38 | +RUN /usr/bin/python3 -m pip install fastcache |
| 39 | +# Needed for multi-language support (currently just Java) |
| 40 | +RUN /usr/bin/python3 -m pip install thriftpy2 |
| 41 | + |
| 42 | +# Java |
| 43 | +RUN apt-get -y --no-install-recommends install openjdk-8-jdk-headless |
| 44 | + |
| 45 | +RUN apt-get -y --no-install-recommends install maven |
| 46 | + |
| 47 | +# Add components (as mfn) |
| 48 | +RUN groupadd -o -g 1000 -r mfn && useradd -d /opt/mfn -u 1000 -m -r -g mfn mfn |
| 49 | +RUN mkdir /opt/mfn/logs |
| 50 | + |
| 51 | +COPY build/queueservice.jar /opt/mfn/ |
| 52 | +ADD frontend/frontend /opt/mfn/frontend |
| 53 | +ADD build/SandboxAgent.tar.gz /opt/mfn/ |
| 54 | +ADD build/FunctionWorker.tar.gz /opt/mfn/ |
| 55 | +ADD build/LoggingService.tar.gz /opt/mfn/ |
| 56 | + |
| 57 | +ADD build/JavaRequestHandler.tar.gz /opt/mfn/ |
| 58 | + |
| 59 | +RUN chmod +x /opt/mfn/JavaRequestHandler/setup_maven.sh |
| 60 | +RUN /opt/mfn/JavaRequestHandler/./setup_maven.sh True |
| 61 | +RUN mvn -Duser.home=/tmp -DskipTests -gs /opt/mfn/JavaRequestHandler/maven/sandbox-mvn-settings.xml -f /opt/mfn/JavaRequestHandler/maven/init-mvn.pom.xml dependency:resolve-plugins |
| 62 | + |
| 63 | +RUN chown mfn:mfn -R /opt/mfn |
| 64 | +USER mfn |
| 65 | +WORKDIR /opt/mfn |
| 66 | +CMD ["python3", "/opt/mfn/SandboxAgent/sandboxagent.py"] |
0 commit comments