File size: 4,582 Bytes
acd4009
 
 
 
 
 
 
 
74f3435
acd4009
 
9599b92
acd4009
9599b92
acd4009
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2282600
acd4009
5c2f6f1
acd4009
2ae823a
acd4009
 
0639487
2282600
acd4009
74f3435
 
de52149
acd4009
bc5e210
5bae10d
c94360a
acd4009
65b2387
53fd145
89841b7
5bae10d
3ea74a4
65b2387
acd4009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
FROM ubuntu:jammy
WORKDIR /root

ENV DEBIAN_FRONTEND noninteractive 
ENV TZ Etc/UTC

RUN apt-get update && \
    apt-get install -y \
        gnupg ca-certificates apt-utils \
        build-essential curl unzip && \
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF 
    
RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list 

RUN apt-get update && \
    apt-get install -y tzdata

RUN apt-get install -y mono-devel \
        gcc-12 g++-12

RUN apt-get update && \
    apt-get install -y software-properties-common python3.11-dev 

RUN apt-get update && \
    apt-get install -y -f libasound2 libc6-i386 libc6-x32 libxi6 libxtst6

ENV JAVA_PKG=https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz \
  JAVA_HOME=/usr/java/jdk-21

RUN set -eux; \
  JAVA_SHA256=$(curl "$JAVA_PKG".sha256) ; \
  curl --output /tmp/jdk.tgz "$JAVA_PKG" && \
  echo "$JAVA_SHA256 */tmp/jdk.tgz" | sha256sum -c; \
  mkdir -p "$JAVA_HOME"; \
  tar --extract --file /tmp/jdk.tgz --directory "$JAVA_HOME" --strip-components 1

RUN curl -OL https://github.com/JetBrains/kotlin/releases/download/v1.7.20/kotlin-compiler-1.7.20.zip
RUN unzip kotlin-compiler-1.7.20.zip -d /usr/local && \
    rm kotlin-compiler-1.7.20.zip

RUN apt-get install -y python2

RUN curl -OL https://go.dev/dl/go1.19.2.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.19.2.linux-amd64.tar.gz && \
    rm go1.19.2.linux-amd64.tar.gz

RUN curl -OL https://downloads.python.org/pypy/pypy3.9-v7.3.9-linux64.tar.bz2
RUN tar -C /usr/local -xf pypy3.9-v7.3.9-linux64.tar.bz2 && \
    rm pypy3.9-v7.3.9-linux64.tar.bz2

RUN curl -OL https://downloads.python.org/pypy/pypy2.7-v7.3.9-linux64.tar.bz2
RUN tar -C /usr/local -xf pypy2.7-v7.3.9-linux64.tar.bz2 && \
    rm pypy2.7-v7.3.9-linux64.tar.bz2

RUN apt-get install -y clang-14

ARG NODE_VERSION=v16.17.1
ARG NODE_DISTRO=linux-x64
ARG NODE_ZIP=node-$NODE_VERSION-$NODE_DISTRO.tar.xz
RUN curl -OL https://nodejs.org/dist/$NODE_VERSION/$NODE_ZIP
RUN tar -C /usr/local -xJvf $NODE_ZIP && \
    rm $NODE_ZIP

ENV RUSTUP_HOME /opt/rust
ENV CARGO_HOME /opt/rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
RUN apt-get install -y ruby-full

RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing php8.1
RUN apt-get install -y libgmp-dev libmpfr-dev 

ENV PATH $PATH:/usr/local/go/bin:/usr/local/kotlinc/bin:/usr/local/node-v16.17.1-linux-x64/bin:/opt/rust/bin

WORKDIR /root


RUN update-alternatives --install /usr/bin/java java "$JAVA_HOME"/bin/java 100 && \
    update-alternatives --install /usr/bin/javac javac "$JAVA_HOME"/bin/javac 100 && \
    update-alternatives --install /usr/bin/jar jar "$JAVA_HOME"/bin/jar 100 && \
    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 && \
    update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 && \
    update-alternatives --install /usr/bin/python python /usr/bin/python3.11 100 && \
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100 && \
    update-alternatives --install /usr/bin/pypy2 pypy2 /usr/local/pypy2.7-v7.3.9-linux64/bin/pypy2 100 && \
    update-alternatives --install /usr/bin/pypy3 pypy3 /usr/local/pypy3.9-v7.3.9-linux64/bin/pypy3 100 

RUN apt-get install -y python3-pip gperf
RUN pip install flask gunicorn flask-cors gmpy2 Cython jsonlines fire 

RUN curl -o libseccomp.tar.gz -L https://github.com/seccomp/libseccomp/releases/download/v2.5.4/libseccomp-2.5.4.tar.gz
RUN tar -xzvf libseccomp.tar.gz && cd libseccomp-2.5.4 && chmod +x configure
WORKDIR /root/libseccomp-2.5.4
RUN ./configure --prefix=/usr --enable-python && make
RUN make install
WORKDIR /root/
RUN rm -rf libseccomp*


ENV RUN_UID 1586
ENV RUN_UID2 1587
ENV RUN_GID 1586
ENV RUN_GID2 1587
ENV NUM_WORKERS 2
ENV GUNICORN_PORT 7860
ENV LOG_LEVEL info

RUN groupadd -g ${RUN_GID} runner${RUN_GID} && useradd -M runner${RUN_UID} -g ${RUN_GID} -u ${RUN_UID}
RUN groupadd -g ${RUN_GID2} runner${RUN_GID2} && useradd -M runner${RUN_UID2} -g ${RUN_GID2} -u ${RUN_UID2}

# EXPOSE ${GUNICORN_PORT} !!!
EXPOSE 7860
RUN useradd -m -u 1000 user

RUN mkdir -p /home/user/execution_engine
COPY --chown=user ./execution_engine /home/user/execution_engine
RUN chmod -R 777 /home/user/execution_engine

USER user
RUN touch /home/user/worker_cfg_db.csv
ENV WORKER_CFG_DB /home/user/worker_cfg_db.csv
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /home/user/execution_engine

CMD ["bash", "start_engine.sh"]