| 1 |
# Build haxelib server as a Docker container. |
| 2 |
# Note that it doesn't contain a MySQL database, |
| 3 |
# which need to be launched seperately. See test/docker-compose.yml on how to launch one. |
| 4 |
|
| 5 |
FROM ubuntu:bionic |
| 6 |
|
| 7 |
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common \ |
| 8 |
&& add-apt-repository ppa:haxe/releases -y \ |
| 9 |
&& apt-get update && apt-get upgrade -y \ |
| 10 |
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \ |
| 11 |
apache2 \ |
| 12 |
neko-dev \ |
| 13 |
haxe \ |
| 14 |
curl \ |
| 15 |
git \ |
| 16 |
libcurl4-gnutls-dev \ |
| 17 |
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \ |
| 18 |
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \ |
| 19 |
nodejs \ |
| 20 |
&& rm -r /var/lib/apt/lists/* |
| 21 |
|
| 22 |
|
| 23 |
# apache httpd |
| 24 |
RUN rm -rf /var/www/html \ |
| 25 |
&& mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html \ |
| 26 |
&& chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html |
| 27 |
RUN a2enmod rewrite |
| 28 |
RUN a2enmod proxy |
| 29 |
RUN a2enmod proxy_http |
| 30 |
RUN a2dismod mpm_event |
| 31 |
RUN a2enmod mpm_prefork |
| 32 |
RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist && rm /etc/apache2/conf-enabled/* /etc/apache2/sites-enabled/* |
| 33 |
COPY apache2.conf /etc/apache2/apache2.conf |
| 34 |
RUN { \ |
| 35 |
echo 'LoadModule neko_module /usr/lib/x86_64-linux-gnu/neko/mod_neko2.ndll'; \ |
| 36 |
echo 'LoadModule tora_module /usr/lib/x86_64-linux-gnu/neko/mod_tora2.ndll'; \ |
| 37 |
echo 'AddHandler tora-handler .n'; \ |
| 38 |
} > /etc/apache2/mods-enabled/tora.conf \ |
| 39 |
&& apachectl stop |
| 40 |
|
| 41 |
|
| 42 |
# haxelib |
| 43 |
ENV HAXELIB_PATH /src/haxelib_global |
| 44 |
RUN mkdir -p ${HAXELIB_PATH} && haxelib setup ${HAXELIB_PATH} |
| 45 |
WORKDIR /src |
| 46 |
COPY libs.hxml run.n /src/ |
| 47 |
RUN haxe libs.hxml |
| 48 |
RUN cp ${HAXELIB_PATH}/aws-sdk-neko/*/ndll/Linux64/aws.ndll /usr/lib/x86_64-linux-gnu/neko/aws.ndll; |
| 49 |
COPY server*.hxml /src/ |
| 50 |
|
| 51 |
COPY www/package*.json /src/www/ |
| 52 |
WORKDIR /src/www/ |
| 53 |
RUN npm install --unsafe-perm |
| 54 |
|
| 55 |
COPY www /src/www/ |
| 56 |
COPY src/legacyhaxelib/.htaccess /src/www/legacy/ |
| 57 |
COPY src/legacyhaxelib/haxelib.css /src/www/legacy/ |
| 58 |
COPY src/legacyhaxelib/website.mtt /src/www/legacy/ |
| 59 |
COPY src /src/src/ |
| 60 |
|
| 61 |
RUN rm -rf /var/www/html |
| 62 |
RUN ln -s /src/www /var/www/html |
| 63 |
RUN mkdir -p /var/www/html/files |
| 64 |
RUN mkdir -p /var/www/html/tmp |
| 65 |
|
| 66 |
WORKDIR /src |
| 67 |
|
| 68 |
RUN haxe server_legacy.hxml |
| 69 |
RUN haxe server_website.hxml |
| 70 |
RUN haxe server_tasks.hxml |
| 71 |
RUN haxe server_api.hxml |
| 72 |
|
| 73 |
EXPOSE 80 |
| 74 |
VOLUME ["/var/www/html/files", "/var/www/html/tmp"] |
| 75 |
CMD apachectl restart && haxelib run tora |