Custom Dockerfile to use local source code

Hi everyone,
What changes do I have to make to the dockerfile to use my customized source code (openemr) stored locally instead of using the git clone image from Github? I’ve tried commenting the following line :

&& git clone https://github.com/openemr/openemr.git --branch master --depth 1 \

and adding: COPY openemr/ \

Any help with be greatly appreciated?

for development purposes the flex docker will spin up your repo of choice, see CONTRIBUTING.md, for production you can build your own image with the changes to the docker file you mention and then add that image to the docker-compose.yml

here’s the Dockerfile that’s used for 6.1.0

Stephen,
Thank you for the prompt response. That is the dockerfile that have been using. Additionally, I have been using the fex image to test changes made to the source code locally. With that being said, With my current setup every time I want to create/test a new image, I have to push my changes to Github and use the dockerfile to clone from Github. I was wondering if there is a way to bypass the git clone config in the dockefile and replace it with the my local repo (source code)?

oh sorry, have you tried replacing that with a rsync --recursive --exclude .git <your openemr dir> .

I am afraid that this might outside my scope of knowledge.

I tried the following without much success:

RUN apk add --no-cache git build-base libffi-dev python3-dev cargo
&& rsync openemr
&& rm -rf openemr/.git
&& cd openemr
&& composer install --no-dev
&& npm install --unsafe-perm
&& npm run build
&& cd ccdaservice
&& npm install --unsafe-perm
&& cd …/ \

Error:

#11 11.75 rsync: [sender] link_stat “/openemr” failed: No such file or directory (2)
#11 11.80 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]

executor failed running [/bin/sh -c apk add --no-cache git build-base libffi-dev python3-dev cargo && rsync openemr && rm -rf openemr/.git && cd openemr && composer install --no-dev && npm install --unsafe-perm && npm run build && cd ccdaservice && npm install --unsafe-perm && cd …/ && composer global require phing/phing && /root/.composer/vendor/bin/phing vendor-clean && /root/.composer/vendor/bin/phing assets-clean && composer global remove phing/phing && composer dump-autoload -o && composer clearcache && npm cache clear --force && rm -fr node_modules && cd …/ && chmod 666 openemr/sites/default/sqlconf.php && chown -R apache openemr/ && mv openemr /var/www/localhost/htdocs/ && git clone https://github.com/letsencrypt/letsencrypt --depth 1 /opt/certbot && pip install --upgrade pip && pip install -e /opt/certbot/acme -e /opt/certbot/certbot && mkdir -p /etc/ssl/certs /etc/ssl/private && apk del --no-cache git build-base libffi-dev python3-dev cargo && sed -i ‘s/^ *CustomLog/#CustomLog/’ /etc/apache2/httpd.conf && sed -i ‘s/^ *ErrorLog/#ErrorLog/’ /etc/apache2/httpd.conf && sed -i ‘s/^ *CustomLog/#CustomLog/’ /etc/apache2/conf.d/ssl.conf && sed -i ‘s/^ *TransferLog/#TransferLog/’ /etc/apache2/conf.d/ssl.conf]: exit code: 23

here’s an edited Dockerfile that hopefully works where ~/src/openemr is your local repo

Hi Stephen,
Good morning! Thank you for taking the time to provide me with an “edited” dockerfile. I must be doing something wrong. Keep in mind that running Docker on Windows. With that in mind, I edited the dockerfile as follows:

PS D:\Dev\openemr live> ls ./src/openemr\

RUN apk add --no-cache git build-base libffi-dev python3-dev cargo
&& rsync --recursive --exclude .git ./src/openemr .
&& cd openemr \

#11 9.721 (23/24) Installing libffi-dev (3.4.2-r1)
#11 9.741 (24/24) Installing python3-dev (3.9.7-r4)
#11 10.71 Executing busybox-1.34.1-r5.trigger
#11 10.72 OK: 1402 MiB in 211 packages
#11 10.76 rsync: [sender] change_dir “/./src” failed: No such file or directory (2)
#11 10.88 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]

executor failed running [/bin/sh -c apk add --no-cache git build-base libffi-dev python3-dev cargo && rsync --recursive --exclude .git ./src/openemr . && cd openemr && composer install --no-dev && npm install --unsafe-perm && npm run build && cd ccdaservice && npm install --unsafe-perm && cd …/ && composer global require phing/phing && /root/.composer/vendor/bin/phing vendor-clean && /root/.composer/vendor/bin/phing assets-clean && composer global remove phing/phing && composer dump-autoload -o && composer clearcache && npm cache clear --force && rm -fr node_modules && cd …/ && chmod 666 openemr/sites/default/sqlconf.php && chown -R apache openemr/ && mv openemr /var/www/localhost/htdocs/
&& git clone --depth 1 /opt/certbot && pip install --upgrade pip && pip install -e /opt/certbot/acme -e /opt/certbot/certbot && mkdir -p /etc/ssl/certs /etc/ssl/private && apk del --no-cache git build-base libffi-dev python3-dev cargo && sed -i ‘s/^ *CustomLog/#CustomLog/’ /etc/apache2/httpd.conf && sed -i ‘s/^ *ErrorLog/#ErrorLog/’ /etc/apache2/httpd.conf && sed -i ‘s/^ *CustomLog/#CustomLog/’ /etc/apache2/conf.d/ssl.conf && sed -i ‘s/^ *TransferLog/#TransferLog/’ /etc/apache2/conf.d/ssl.conf]: exit cod

where’s your local directory of customized source code?

Here is my directory restructure:

PS D:\Dev\openemr live> ls

Here the docker file:
Mode LastWriteTime Length Name


d----- 6/15/2022 4:40 PM src
d----- 6/14/2022 3:10 PM upgrade
d----- 6/14/2022 3:10 PM utilities
-a---- 6/13/2022 1:55 PM 30 .dockerignore
-a---- 6/13/2022 1:55 PM 18 .gitignore
-a---- 6/13/2022 1:55 PM 2112 auto_configure.php
-a---- 6/14/2022 4:17 PM 1042 docker-compose.yml
-a---- 6/16/2022 9:26 AM 4046 Dockerfile
-a---- 6/13/2022 1:55 PM 2638 openemr.conf
-a---- 6/13/2022 1:55 PM 8136 openemr.sh
-a---- 6/13/2022 1:55 PM 74823 php.ini
-a---- 6/13/2022 1:55 PM 3301 README.md
-a---- 6/13/2022 1:55 PM 2109 ssl.sh
-a---- 6/13/2022 1:55 PM 1975 xdebug.sh

PS D:\Dev\openemr live> ls
Here is the src\openmer:

Mode LastWriteTime Length Name


d----- 6/15/2022 11:55 AM .github
d----- 6/15/2022 11:55 AM apis
d----- 6/15/2022 11:55 AM bin
d----- 6/15/2022 11:55 AM ccdaservice
d----- 6/15/2022 11:55 AM ccr
d----- 6/15/2022 11:55 AM ci
d----- 6/15/2022 11:55 AM config
d----- 6/15/2022 11:55 AM contrib
d----- 6/15/2022 11:55 AM controllers
d----- 6/15/2022 11:55 AM custom
d----- 6/15/2022 11:55 AM docker
d----- 6/15/2022 11:55 AM Documentation
d----- 6/15/2022 11:55 AM gacl
d----- 6/15/2022 11:55 AM interface
d----- 6/15/2022 11:55 AM library
d----- 6/15/2022 11:55 AM modules
d----- 6/15/2022 11:55 AM oauth2
d----- 6/15/2022 11:55 AM portal
d----- 6/15/2022 11:55 AM public
d----- 6/15/2022 11:55 AM sites
d----- 6/15/2022 11:55 AM sphere
d----- 6/15/2022 11:55 AM sql
d----- 6/15/2022 11:55 AM src
d----- 6/15/2022 11:55 AM swagger
d----- 6/15/2022 11:55 AM templates
d----- 6/15/2022 11:55 AM tests
-a---- 6/14/2022 4:32 PM 135 .editorconfig
-a---- 6/14/2022 4:32 PM 82 .env.example
-a---- 6/14/2022 4:32 PM 460 .gitignore
-a---- 6/14/2022 4:32 PM 303 .stylelintignore
-a---- 6/14/2022 4:32 PM 767 .stylelintrc.json
-a---- 6/14/2022 4:32 PM 22618 acknowledge_license_cert.html
-a---- 6/14/2022 4:32 PM 59852 acl_upgrade.php
-a---- 6/14/2022 4:32 PM 10794 admin.php
-a---- 6/14/2022 4:32 PM 26804 API_README.md
-a---- 6/14/2022 4:32 PM 5359 build.xml
-a---- 6/14/2022 4:32 PM 129 cloudbuild.yaml
-a---- 6/14/2022 4:32 PM 5606 CODE_OF_CONDUCT.md
-a---- 6/14/2022 4:32 PM 4511 composer.json
-a---- 6/14/2022 4:32 PM 483009 composer.lock
-a---- 6/14/2022 4:32 PM 29221 CONTRIBUTING.md
-a---- 6/14/2022 4:32 PM 115 controller.php
-a---- 6/14/2022 4:32 PM 3 docker-version
-a---- 6/14/2022 4:32 PM 2249 DOCKER_README.md
-a---- 6/14/2022 4:32 PM 12672 FHIR_README.md
-a---- 6/14/2022 4:32 PM 23691 gulpfile.js
-a---- 6/14/2022 4:32 PM 945 index.php
-a---- 6/14/2022 4:32 PM 6508 ippf_upgrade.php
-a---- 6/14/2022 4:32 PM 35821 LICENSE
-a---- 6/14/2022 4:32 PM 651414 package-lock.json
-a---- 6/14/2022 4:32 PM 3637 package.json
-a---- 6/14/2022 4:32 PM 2228 phpunit.xml
-a---- 6/14/2022 4:32 PM 3085 README.md
-a---- 6/14/2022 4:32 PM 28 robots.txt
-a---- 6/14/2022 4:32 PM 107189 setup.php
-a---- 6/14/2022 4:32 PM 5087 sql_patch.php
-a---- 6/14/2022 4:32 PM 18040 sql_upgrade.php
-a---- 6/14/2022 4:32 PM 2147 version.php
-a---- 6/14/2022 4:32 PM 23160 _rest_config.php
-a---- 6/14/2022 4:32 PM 488809 _rest_routes.inc.php

you can build the docker image outside of your git repo directory by specifying the path to it relative to where you’ll build from

like from /Dev/openemr/docker_images

path would be rsync --recursive --exclude .git ../src/openemr