FROM git.ia2.inaf.it:5050/ia2/rap-ia2/composer

FROM git.ia2.inaf.it:5050/ia2/rap-ia2/base

# add RAP Apache configuration
COPY docker/rap.conf /etc/apache2/conf-available/
RUN a2enconf rap.conf

# enable mod_rewrite and mod_headers (for Flight framework)
RUN a2enmod rewrite
RUN a2enmod headers

ARG RAP_DIR=/var/www/html/rap-ia2/

# create RAP directory
RUN mkdir $RAP_DIR
COPY --from=0 /rap-ia2 $RAP_DIR

WORKDIR $RAP_DIR

# create logs directory
RUN mkdir -p logs

RUN chown -R www-data $RAP_DIR

# allow apache2 to stop gracefully
STOPSIGNAL SIGWINCH

EXPOSE 80
CMD ["apachectl", "-D", "FOREGROUND"]
