forked from France-ioi/bebras-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bebras-core.Dockerfile
128 lines (93 loc) · 2.88 KB
/
bebras-core.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
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
126
127
128
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ARG USE_IR=false
WORKDIR /etc/apt
COPY ubuntu-source.list.ir /etc/apt/sources.list.ir
RUN if [ "$USE_IR" = "true" ]; then mv sources.list.ir sources.list; fi
RUN echo "Building with $(if [ "$USE_IR" = "true" ]; then echo "Iranian"; else echo "default"; fi) sources"
# Install necessary packages
RUN apt-get update && apt-get install -y \
software-properties-common \
curl \
zip \
unzip \
git \
supervisor \
sqlite3 \
libsqlite3-dev \
libcurl4-openssl-dev \
pkg-config \
libssl-dev \
apache2 \
mysql-client
# Enable apache modules
RUN a2enmod rewrite
RUN a2enmod headers
RUN a2enmod ssl
RUN a2enmod proxy
RUN a2enmod proxy_http
# Add repository for PHP 7.2
RUN add-apt-repository -y ppa:ondrej/php
## Install PHP 7.2 and some extensions
RUN apt-get update && apt-get install -y \
php7.2-cli \
php7.2-common \
php7.2-curl \
php7.2-json \
php7.2-xml \
php7.2-mbstring \
php7.2-zip \
php7.2-gd \
php7.2-sqlite3 \
php7.2-mysql \
php7.2-intl
## configure php to work with apache
RUN apt-get install -y libapache2-mod-php7.2
RUN a2dismod mpm_event
RUN a2enmod mpm_prefork
RUN a2enmod php7.2
RUN service apache2 restart
# Intall composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Node.js version 18
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g bower
# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /var/www/html/bebras-platform
# Copy project files into docker image
COPY . .
# Change ownership of the contestInterface directory to www-data
RUN chown -R www-data:www-data /var/www/html/bebras-platform/contestInterface
# Install PHP dependencies
RUN composer install
# Change working directory to contestInterface
WORKDIR /var/www/html/bebras-platform/contestInterface
# Run Bower install
RUN bower install --allow-root
# Change Working directory to teacherInterface
WORKDIR /var/www/html/bebras-platform/teacherInterface
# Run Bower install
RUN bower install --allow-root
WORKDIR /var/www/html/bebras-platform
# Expose port 80
EXPOSE 80
# Copy apache configuration file
COPY apache-confs/base.conf /etc/apache2/sites-available/000-default.conf
COPY apache-confs/.htpasswd /etc/apache2/.htpasswd
# COPY apache-confs/ssl.conf /etc/apache2/sites-available/default-ssl.conf
COPY start-apache.sh /usr/local/bin/start-apache.sh
# enable apache configuration
RUN a2ensite 000-default.conf
RUN chmod +x /usr/local/bin/start-apache.sh
CMD ["/usr/local/bin/start-apache.sh"]
# Enable apache configuration
#RUN a2ensite default-ssl.conf
#RUN service apache2 restart
# Start apache
#CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]