forked from sio2project/oioioi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
88 lines (70 loc) · 2.42 KB
/
Dockerfile
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
FROM python:3.8
ENV PYTHONUNBUFFERED 1
#RUN dpkg --add-architecture i386
RUN apt-get update && \
apt-get install -y \
git \
libpq-dev \
postgresql-client \
libdb-dev \
texlive-latex-base \
texlive-lang-polish \
texlive-latex-extra \
texlive-lang-german \
texlive-lang-european \
texlive-lang-czechslovak \
texlive-pstricks \
ghostscript \
texlive-fonts-recommended \
gcc \
sudo \
libstdc++6 \
zlib1g \
sox \
flite \
locales \
python3-pip && \
apt-get clean
# This is oioioi user linux uid. Setting it is useful in development.
# By default we use an unused uid of 1234.
# This is placed here to avoid redownloading package on uid change
ARG oioioi_uid=1234
#Bash as shell, setup folders, create oioioi user
RUN rm /bin/sh && ln -s /bin/bash /bin/sh && \
mkdir -pv /sio2/oioioi && \
mkdir -pv /sio2/sandboxes && \
useradd -U oioioi -m -d /home/oioioi/ -u $oioioi_uid && \
echo "oioioi ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chown -R oioioi:oioioi /sio2
# Modify locale
RUN sed -i -e "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" /etc/locale.gen && \
locale-gen
COPY ./entrypoint_checks.sh /entrypoint_checks.sh
RUN chmod +x /entrypoint_checks.sh && chown oioioi /entrypoint_checks.sh
# Installing python dependencies
USER oioioi
ENV PATH $PATH:/home/oioioi/.local/bin/
ENV BERKELEYDB_DIR /usr
RUN pip3 install --user psycopg2-binary==2.8.6 twisted uwsgi
RUN pip3 install --user bsddb3==6.2.7
WORKDIR /sio2/oioioi
COPY --chown=oioioi:oioioi setup.py requirements.txt ./
RUN pip3 install -r requirements.txt --user
COPY --chown=oioioi:oioioi requirements_static.txt ./
RUN pip3 install -r requirements_static.txt --user
COPY --chown=oioioi:oioioi . /sio2/oioioi
ENV OIOIOI_DB_ENGINE 'django.db.backends.postgresql'
ENV RABBITMQ_HOST 'broker'
ENV RABBITMQ_PORT '5672'
ENV RABBITMQ_USER 'oioioi'
ENV RABBITMQ_PASSWORD 'oioioi'
ENV FILETRACKER_LISTEN_ADDR '0.0.0.0'
ENV FILETRACKER_LISTEN_PORT '9999'
ENV FILETRACKER_URL 'http://web:9999'
RUN oioioi-create-config /sio2/deployment
WORKDIR /sio2/deployment
RUN mkdir -p /sio2/deployment/logs/{supervisor,runserver}
# Download sandboxes
RUN ./manage.py supervisor > /dev/null --daemonize --nolaunch=uwsgi && \
./manage.py download_sandboxes -q -y -c /sio2/sandboxes && \
./manage.py supervisor stop all