-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
118 lines (100 loc) · 3.51 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
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
FROM php:8.3-apache-bookworm
## https://hub.docker.com/_/php/tags?page=1&name=apache
ARG DEBIAN_FRONTEND=noninteractive
# Install Webserver dep
RUN apt-get update -qq && \
apt-get -yq --no-install-recommends install \
msmtp-mta \
ca-certificates \
git \
vim \
ssh \
wget \
libpng-dev \
libzip-dev \
zip \
ghostscript \
libmagickwand-dev \
libyaml-dev \
# cron req
busybox-static \
# yaml support for user prov
&& pecl install yaml \
# INSTALL IMAGICK
#&& pecl install imagick \
#&& docker-php-ext-enable imagick \
# INSTALL MYSQLI AND OTHER DOCKER FUN
&& docker-php-ext-install gd zip mysqli \
### cleanup
&& rm -r /var/lib/apt/lists/*
# Install imagick from source as there is no PECL version
RUN apt-get update -qq && \
apt-get -yq --no-install-recommends install git && \
git clone https://github.com/Imagick/imagick.git --depth 1 /tmp/imagick && \
cd /tmp/imagick && \
git fetch origin master && \
git switch master && \
cd /tmp/imagick && \
phpize && \
./configure && \
make && \
make install && \
docker-php-ext-enable imagick && \
# cleanup
apt-get -yq purge git && \
rm -r /tmp/imagick
# Update ImageMagick policy
RUN sed -i 's/policy\ domain=\"coder\" rights=\"none\" pattern=\"PDF\"/policy domain=\"coder\" rights=\"read\" pattern=\"PDF\"/g' /etc/ImageMagick-6/policy.xml
# REDCap Container configs,templates and scripts
COPY container_assets /opt/redcap-docker/assets
RUN chmod -R +x /opt/redcap-docker/assets/scripts/
# Deploy php.ini
RUN mv /opt/redcap-docker/assets/config/php/php.ini /usr/local/etc/php/php.ini && \
chmod 600 /usr/local/etc/php/php.ini && \
rm -r /opt/redcap-docker/assets/config/php
# Deploy apache virtual host
RUN rm -R /etc/apache2/sites-enabled && \
mv /opt/redcap-docker/assets/config/apache2/sites-enabled /etc/apache2/sites-enabled && \
chmod -R 644 /etc/apache2/sites-enabled
# Deploy apache config
RUN mv /opt/redcap-docker/assets/config/apache2/conf-enabled/* /etc/apache2/conf-enabled && \
chmod -R 644 /etc/apache2/conf-enabled && \
rm -r /opt/redcap-docker/assets/config/apache2
ENV WWW_DATA_UID=33
ENV WWW_DATA_GID=33
ENV FIX_REDCAP_DIR_PERMISSIONS=true
ENV PHP_INI_SCAN_DIR=/usr/local/etc/php.d:/config/php/custom_inis:
ENV SERVER_NAME localhost
ENV SERVER_ADMIN root
ENV SERVER_ALIAS localhost
ENV APACHE_RUN_HOME /var/www
ENV APACHE_DOCUMENT_ROOT /var/www/html
ENV APACHE_ERROR_LOG /dev/stdout
ENV APACHE_ACCESS_LOG /dev/stdout
ENV REDCAP_INSTALL_ENABLE=true
ENV REDCAP_INSTALL_SQL_SCRIPT_PATH=/config/redcap/install/install.sql
ENV REDCAP_SUSPEND_SITE_ADMIN=false
# USER Provisioning
ENV ENABLE_USER_PROV=true
ENV USER_PROV_FILE_DIR=/opt/redcap-docker/users
RUN mkdir -p $USER_PROV_FILE_DIR
ENV USER_PROV_OVERWRITE_EXISTING=false
# Application default config
ENV RCCONF_redcap_base_url=http://localhost
ENV RCCONF_password_algo=sha512
ENV RCCONF_hook_functions_file=/var/www/html/hook_functions.php
# cron default config
ENV CRON_MODE=false
ENV CRON_INTERVAL="*/5 * * * *"
ENV CRON_RUN_JOB_ON_START=false
ENV CRON_HEALTH_STATE_FILE=/tmp/cron-health.txt
# register cron command
RUN ln -s /opt/redcap-docker/assets/scripts/cron-job.sh /usr/bin/redcap-cron
# Enable apache extensions
RUN a2enmod proxy_http
RUN a2enmod rewrite
# log mstmp (sendmail) to stdout
ENV MSMTP_logfile=-
# define healthcheck
HEALTHCHECK --interval=5s --timeout=3s CMD /opt/redcap-docker/assets/scripts/healthcheck.sh
CMD ["/opt/redcap-docker/assets/scripts/container_start.sh"]