|
| 1 | +FROM alpine:3.18 |
| 2 | + |
| 3 | +#Install dependencies and fix issue in apache |
| 4 | +RUN apk --no-cache upgrade |
| 5 | +RUN apk add --no-cache \ |
| 6 | + apache2 apache2-ssl apache2-utils git php82 php82-tokenizer php82-ctype php82-session php82-apache2 \ |
| 7 | + php82-json php82-pdo php82-pdo_mysql php82-curl php82-ldap php82-openssl php82-iconv \ |
| 8 | + php82-xml php82-xsl php82-gd php82-zip php82-soap php82-mbstring php82-zlib \ |
| 9 | + php82-mysqli php82-sockets php82-xmlreader php82-redis php82-simplexml php82-xmlwriter php82-phar php82-fileinfo \ |
| 10 | + php82-sodium php82-calendar php82-intl php82-opcache php82-pecl-apcu \ |
| 11 | + perl mysql-client tar curl imagemagick nodejs npm \ |
| 12 | + certbot openssl openssl-dev dcron \ |
| 13 | + rsync shadow ncurses \ |
| 14 | + && sed -i 's/^Listen 80$/Listen 0.0.0.0:80/' /etc/apache2/httpd.conf |
| 15 | +# Needed to ensure permissions work across shared volumes with openemr, nginx, and php-fpm dockers |
| 16 | +RUN usermod -u 1000 apache |
| 17 | + |
| 18 | +#BELOW LINE NEEDED TO SUPPORT PHP8 ON ALPINE 3.13+; SHOULD BE ABLE TO REMOVE THIS IN FUTURE ALPINE VERSIONS |
| 19 | +RUN cp /usr/bin/php82 /usr/bin/php |
| 20 | +# Install composer for openemr package building |
| 21 | +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer |
| 22 | + |
| 23 | +RUN apk add --no-cache git build-base \ |
| 24 | + && git clone https://github.com/openemr/openemr.git --depth 1 \ |
| 25 | + && rm -rf openemr/.git \ |
| 26 | + && cd openemr \ |
| 27 | + && composer install --no-dev \ |
| 28 | + && npm install --unsafe-perm \ |
| 29 | + && npm run build \ |
| 30 | + && cd ccdaservice \ |
| 31 | + && npm install --unsafe-perm \ |
| 32 | + && cd ../ \ |
| 33 | + && composer global require phing/phing \ |
| 34 | + && /root/.composer/vendor/bin/phing vendor-clean \ |
| 35 | + && /root/.composer/vendor/bin/phing assets-clean \ |
| 36 | + && composer global remove phing/phing \ |
| 37 | + && composer dump-autoload --optimize --apcu \ |
| 38 | + && composer clearcache \ |
| 39 | + && npm cache clear --force \ |
| 40 | + && rm -fr node_modules \ |
| 41 | + && cd ../ \ |
| 42 | + && chmod 666 openemr/sites/default/sqlconf.php \ |
| 43 | + && chown -R apache openemr/ \ |
| 44 | + && mv openemr /var/www/localhost/htdocs/ \ |
| 45 | + && mkdir -p /etc/ssl/certs /etc/ssl/private \ |
| 46 | + && apk del --no-cache git build-base \ |
| 47 | + && sed -i 's/^ *CustomLog/#CustomLog/' /etc/apache2/httpd.conf \ |
| 48 | + && sed -i 's/^ *ErrorLog/#ErrorLog/' /etc/apache2/httpd.conf \ |
| 49 | + && sed -i 's/^ *CustomLog/#CustomLog/' /etc/apache2/conf.d/ssl.conf \ |
| 50 | + && sed -i 's/^ *TransferLog/#TransferLog/' /etc/apache2/conf.d/ssl.conf |
| 51 | +WORKDIR /var/www/localhost/htdocs/openemr |
| 52 | +VOLUME [ "/etc/letsencrypt/", "/etc/ssl" ] |
| 53 | +#configure apache & php properly |
| 54 | +ENV APACHE_LOG_DIR=/var/log/apache2 |
| 55 | +COPY php.ini /etc/php82/php.ini |
| 56 | +COPY openemr.conf /etc/apache2/conf.d/ |
| 57 | +#add runner and auto_configure and prevent auto_configure from being run w/o being enabled |
| 58 | +COPY openemr.sh ssl.sh xdebug.sh auto_configure.php /var/www/localhost/htdocs/openemr/ |
| 59 | +COPY utilities/unlock_admin.php utilities/unlock_admin.sh /root/ |
| 60 | +RUN chmod 500 openemr.sh ssl.sh xdebug.sh /root/unlock_admin.sh \ |
| 61 | + && chmod 000 auto_configure.php /root/unlock_admin.php |
| 62 | +#bring in pieces used for automatic upgrade process |
| 63 | +COPY upgrade/docker-version \ |
| 64 | + upgrade/fsupgrade-1.sh \ |
| 65 | + upgrade/fsupgrade-2.sh \ |
| 66 | + upgrade/fsupgrade-3.sh \ |
| 67 | + upgrade/fsupgrade-4.sh \ |
| 68 | + upgrade/fsupgrade-5.sh \ |
| 69 | + /root/ |
| 70 | +RUN chmod 500 \ |
| 71 | + /root/fsupgrade-1.sh \ |
| 72 | + /root/fsupgrade-2.sh \ |
| 73 | + /root/fsupgrade-3.sh \ |
| 74 | + /root/fsupgrade-4.sh \ |
| 75 | + /root/fsupgrade-5.sh |
| 76 | +#fix issue with apache2 dying prematurely |
| 77 | +RUN mkdir -p /run/apache2 |
| 78 | +#Copy dev tools library to root |
| 79 | +COPY utilities/devtoolsLibrary.source /root/ |
| 80 | +#Ensure swarm/orchestration pieces are available if needed |
| 81 | +RUN mkdir /swarm-pieces \ |
| 82 | + && rsync --owner --group --perms --delete --recursive --links /etc/ssl /swarm-pieces/ \ |
| 83 | + && rsync --owner --group --perms --delete --recursive --links /var/www/localhost/htdocs/openemr/sites /swarm-pieces/ |
| 84 | +#go |
| 85 | +CMD [ "./openemr.sh" ] |
| 86 | + |
| 87 | +EXPOSE 80 443 |
0 commit comments