diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0b8ab780..147ec09a 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,10 +1,11 @@ -name: Docker - +name: Publish Docker image on: push: + # TODO: Add push type for release # Publish `master` as Docker `latest` image. branches: - master + - mysql # Publish `v1.2.3` tags as releases. tags: @@ -13,91 +14,68 @@ on: # Run tests for any PRs. pull_request: -env: - # TODO: Change variable to your image's name. - IMAGE_NAME: image - -jobs: - # Run tests. + # steps: +# - uses: actions/checkout@v2 + # Setup mysqlserver. # See also https://docs.docker.com/docker-hub/builds/automated-testing/ - test: - runs-on: ubuntu-20.04 - - services: - mysql: - image: mysql:8.0.23 - env: - MYSQL_USER: test - MYSQL_ROOT_PASSWORD: test - ports: - - 3306 - - steps: - - uses: actions/checkout@v2 - - - name: Get the mysql host - id: get_host - run: | - #host=`docker network inspect -f '{{(index .IPAM.Config 0).Gateway}}' bridge` - #echo "db-host=$host" >> $GITHUB_OUTPUT - #echo "$db-host" - sudo apt -y install mysql-client - mysql -uroot --password=test -h ${{ steps.get_host.outputs.db-host }} --port ${{ job.services.mysql.ports['3306'] }} -e 'show databases;' - - - name: Copy envs - run: | - cp -a .env-org server/.env - sed -i 's/127.0.0.1/${{ steps.get_host.outputs.db-host }}/g' server/.env - cat server/.env - - - - - name: Run tests - run: | - if [ -f docker-compose.test.yml ]; then - docker-compose --file docker-compose.test.yml build - docker-compose --file docker-compose.test.yml run sut - else - docker build . --file server/Dockerfile --build-arg="$db-host" - fi - - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - push: - # Ensure test job passes before pushing image. - needs: test - +jobs: + mysql57: runs-on: ubuntu-latest - if: github.event_name == 'push' - steps: - - uses: actions/checkout@v2 - - - name: Build image - run: docker build . --file server/Dockerfile --tag $IMAGE_NAME - - - name: Log into GitHub Container Registry - # TODO: Create a PAT with `read:packages` and `write:packages` scopes and save it as an Actions secret `CR_PAT` - run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Push image to GitHub Container Registry - run: | - IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - - # Use Docker `latest` tag convention - [ "$VERSION" == "master" ] && VERSION=latest - - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - - docker tag $IMAGE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION + - uses: actions/checkout@v2 + - name: Shutdown existing MySQL + run: sudo service mysql stop + + + push_to_registries: + #- name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Set up MySQL + uses: cweinberger/github-actions-mysql@main + with: + version: 5.7 + hostPort: 3306 + containerPort: 3306 + rootPassword: root + user: TestUser + password: TestPassword + database: TestDatabase + characterSet: utf8mb4 + collation: utf8mb4_general_ci + sqlMode: NO_ENGINE_SUBSTITUTION + + - name: Print running docker containers + run: docker ps + - name: Check out the repo + uses: actions/checkout@v3 + - name: Wait for mysql + run: sleep 15 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Log in to Docker Hub + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + # username: curtishall + # password: ${{ secrets.DOCKER_PASSWORD }} +# - name: Extract metadata (tags, labels) for Docker +# id: meta +# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 +# with: +# images: bluecherrydvr/bluecherry + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + #working-directory: server/ + context: "{{defaultContext}}:server" + # username: curtishall + # password: ${{ secrets.DOCKER_PASSWORD }} +# file: ./server/Dockerfile + push: true + tags: bluecherrydvr/bluecherry:citesting + labels: github_ci diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..4d81e86b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,305 @@ +# This really belongs in server/. however some github actions do not like it in a sub directory + +# set a base image with environment to build from +FROM ubuntu:20.04 AS baseos +#RUN echo $DB_HOST +#ARG DB_HOST=$BLUECHERRY_DB_HOST +#RUN echo $BLUECHERRY_DB_HOST + +ARG BLUECHERRY_GIT_BRANCH_TAG=v3.1.0-latest +#ARG MYSQLHOST +#ENV MYSQL_HOST=MYSQLHOST + +#RUN echo "Testing github network env" +#RUN echo ${{ steps.github-network.outputs.gateway-address }} +RUN echo $MYSQL_HOST + +# --------------------------------------------------------------------------- +# Build the base OS with some development libs and tools +FROM baseos AS os_dev_environment +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +CMD ["echo", "Testing mysql connection via nmap..."] + +RUN apt-get update +RUN apt-get -y install nmap +#RUN nmap mysql -p 3306 + +CMD ["echo", "Installing other stuff..."] + +#RUN apt-get install --no-install-recommends -y \ +# git sudo openssl ca-certificates wget gnupg gnupg2 gnupg1 \ +# ssl-cert nmap curl sysstat iproute2 \ +# autoconf automake libtool build-essential gcc g++ \ +# debhelper ccache bison flex texinfo yasm cmake + +#RUN apt-get install --no-install-recommends -y \ +# libbsd-dev libopencv-dev libudev-dev libva-dev \ +# linux-image-generic linux-headers-generic \ +# libmysqlclient-dev rsyslog + +CMD ["echo", "Testing mysql connection..."] + +RUN apt install -y mysql-client +#RUN ip a +#RUN mysql -uroot -proot -h 172.17.0.1 -e 'SELECT version()' + + +# --------------------------------------------------------------------------- +#FROM os_dev_environment as bluecherry_base_environment +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +#RUN git clone --progress --depth 1 \ +# http://github.com/bluecherrydvr/bluecherry-apps.git \ +# && cd bluecherry-apps \ +# && git checkout $BLUECHERRY_GIT_BRANCH_TAG + +#RUN apt-get --no-install-recommends -y install \ +# libbsd0 libc6 libgcc1 libssl1.1 libstdc++6 libudev1 \ +# zlib1g ucf mkvtoolnix v4l-utils vainfo i965-va-driver + +CMD ["echo", "**************** NMAP output..."] +RUN apt-get update +RUN apt-get -y install nmap +RUN nmap 127.0.0.1 -p 3306 + +CMD ["echo", "Installing other stuff..."] + +RUN apt install -y --no-install-recommends wget sudo gnupg +#RUN wget -q https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 -O- | apt-key add - +RUN apt update + +#RUN apt-get --no-install-recommends -y install \ +# php-mail php-mail-mime php-net-smtp php-gd php-curl \ +# php-mysql php-sqlite3 \ +# mysql-client sqlite3 + +# --------------------------------------------------------------------------- +# Build the bluecherry app and dependencies. This is done in a separate +# image because there are many ways it can fail and then we save time +# by being able to reuse prior containers leading up to this build. +#FROM bluecherry_base_environment as bluecherry_build +#ENV DEBIAN_FRONTEND=noninteractive +#WORKDIR /root + +#COPY depends/onvif_tool bluecherry-apps/utils/onvif_tool + +#RUN cd bluecherry-apps \ +# && ./scripts/build_pkg_native.sh + + +# --------------------------------------------------------------------------- +#FROM bluecherry_build as bluecherry_build_cleaned +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +RUN rm -rf /usr/src/linux-headers-* + +RUN rm -rf .ccache \ + && rm -rf bluecherry-apps/.git \ + && rm -rf bluecherry-apps/misc/libav \ + && rm -rf bluecherry-apps/misc/libconfig \ + && rm -rf bluecherry-apps/misc/pugixml + + +# --------------------------------------------------------------------------- +# Install the bluecherry app and dependencies +#FROM baseos as bluecherry_install +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +#COPY --from=bluecherry_build_cleaned \ +# /root/bluecherry-apps/releases/bluecherry_*.deb \ +# /root/bluecherry-apps/releases/ +RUN apt update +#RUN apt install --no-install-recommends -y wget mariadb-client libopencv-core libopencv-imgcodecs libopencv-imgproc libva-drm2 libva2 mkvtoolnix php-mail php-mail-mime \# +# php-net-smtp sqlite3 nginx php-fpm php-mysql php-sqlite3 v4l-utils vainfo i965-va-driver php-gd php-curl mariadb-client python3-pip python3-distutils gnupg2 +RUN apt install --no-install-recommends -y libbsd0 libc6 libgcc-s1 libmariadb3 libopencv-core4.2 libopencv-imgcodecs4.2 libopencv-imgproc4.2 curl \ + libssl1.1 libstdc++6 libudev1 libva-drm2 libva2 zlib1g ssl-cert ucf curl sysstat mkvtoolnix php-mail \ + php-mail-mime php-net-smtp sqlite3 nmap nginx php-fpm php-mysql php-sqlite3 v4l-utils vainfo i965-va-driver mysql-client python3-pip + + + +#RUN wget https://unstable.bluecherrydvr.com/pool/focal/bluecherry_3.1.0-rc8_amd64.deb +RUN curl -k -o /tmp/bluecherry_3.1.0-rc8_amd64.deb https://unstable.bluecherrydvr.com/pool/focal/bluecherry_3.1.0-rc8_amd64.deb + +#COPY depends/bluecherry_3.1.0-rc8_amd64.deb /tmp/bluecherry_3.1.0-rc8_amd64.deb + +# This step is needed if/when building a new bluecherry docker container +# that will connect to an existing bluecherry database. In this case, the +# bluecherry installer will see the existing database, and it needs the +# /etc/bluecherry.conf file to tell it that it is okay to connect to (and +# modify) that database +# +#COPY bluecherry.conf /etc/bluecherry.conf + +ARG MYSQL_ADMIN_LOGIN=root +ARG MYSQL_ADMIN_PASSWORD=root + +# Specific database credentials used by bluecherry server +ARG BLUECHERRY_DB_USER=bluecherry +ARG BLUECHERRY_DB_HOST=172.17.0.1 +ARG BLUECHERRY_DB_PASSWORD=qiNdklOierSZs2 +ARG BLUECHERRY_DB_NAME=bluecherry +ARG BLUECHERRY_DB_ACCESS_HOST='%' + +# User and Group info used for running bluecherry server processes +ARG BLUECHERRY_LINUX_GROUP_NAME=bluecherry +ARG BLUECHERRY_LINUX_GROUP_ID=1000 +ARG BLUECHERRY_LINUX_USER_NAME=bluecherry +ARG BLUECHERRY_LINUX_USER_ID=1000 + +RUN apt-get update \ + && apt-get install -y \ + wget sudo rsyslog nmap curl sysstat iproute2 \ + openssl ca-certificates ssl-cert gnupg gnupg2 gnupg1 + +#COPY my.cnf /root/.my.cnf + +#RUN { \ +# echo "[client]"; \ +# echo "user=$MYSQL_ADMIN_LOGIN"; \ +# echo "password=$MYSQL_ADMIN_PASSWORD"; \ +# echo "[mysql]"; \ +# echo "user=$MYSQL_ADMIN_LOGIN"; \ +# echo "password=$MYSQL_ADMIN_PASSWORD"; \ +# echo "[mysqldump]"; \ +# echo "user=$MYSQL_ADMIN_LOGIN"; \ +# echo "password=$MYSQL_ADMIN_PASSWORD"; \ +# echo "[mysqldiff]"; \ +# echo "user=$MYSQL_ADMIN_LOGIN"; \ +# echo "password=$MYSQL_ADMIN_PASSWORD"; \ +# } > /root/.my.cnf + +# NOTE: The line "export host=$BLUECHERRY_DB_HOST" ... This is required +# due to a weird global check of this env var by the "check_mysql_admin" +# function in /usr/share/bluecherry/bc_db_tool.sh ... which doesn't accept +# the db host as an argument like most of the other functions in that file. +# --- The Specific problem line is: +# if ! echo "show databases" | mysql_wrapper -h"${host}" -u"$MYSQL_ADMIN_LOGIN" &>/dev/null +# +#RUN { \ +# echo bluecherry bluecherry/mysql_admin_login string $MYSQL_ADMIN_LOGIN; \ +# echo bluecherry bluecherry/mysql_admin_password password $MYSQL_ADMIN_PASSWORD; \ +# echo bluecherry bluecherry/db_host string $BLUECHERRY_DB_HOST; \ +## echo bluecherry bluecherry/db_host string mysql \ +# echo bluecherry bluecherry/db_userhost string $BLUECHERRY_DB_ACCESS_HOST; \ +# echo bluecherry bluecherry/db_name string $BLUECHERRY_DB_NAME; \ +# echo bluecherry bluecherry/db_user string $BLUECHERRY_DB_USER; \ +# echo bluecherry bluecherry/db_password password $BLUECHERRY_DB_PASSWORD; \ +# } | debconf-set-selections \ +# && export host=mysql \ +# && export host=$BLUECHERRY_DB_HOST \ +# && dpkg -i /tmp/bluecherry_3.1.0-rc8_amd64.deb + +RUN apt install -y php-curl php-gd + +RUN { \ + echo bluecherry bluecherry/mysql_admin_login string $MYSQL_ADMIN_LOGIN; \ + echo bluecherry bluecherry/mysql_admin_password password $MYSQL_ADMIN_PASSWORD; \ + echo bluecherry bluecherry/db_host string $BLUECHERRY_DB_HOST; \ + echo bluecherry bluecherry/db_userhost string $BLUECHERRY_DB_ACCESS_HOST; \ + echo bluecherry bluecherry/db_name string $BLUECHERRY_DB_NAME; \ + echo bluecherry bluecherry/db_user string $BLUECHERRY_DB_USER; \ + echo bluecherry bluecherry/db_password password $BLUECHERRY_DB_PASSWORD; \ + } | debconf-set-selections \ +# && export DB_HOST="mysql" \ +# && export HOST=mysql \ +&& dpkg -i /tmp/bluecherry_3.1.0-rc8_amd64.deb + + + +# Cleanup tasks +RUN apt-get clean \ +# && rm -f bluecherry-apps/releases/bluecherry_*.deb \ + && rm -rf /var/lib/apt/lists/* + +# Remove these files -- we needed them to build the docker image, since the +# bluecherry installer scripts interact with the database. However, once the +# image is created, we expect it to receive all of the settings/credentials +# from environment variables passed in by docker or docker-compose. +#RUN rm -f /root/.my.cnf \ +RUN rm -f /etc/bluecherry.conf + +# When running rsyslog in a container, we need to disable imklog +# since the in-container process won't be allowed access to it. +#RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf + +RUN /usr/sbin/groupadd -rf \ + --gid=$BLUECHERRY_LINUX_GROUP_ID \ + $BLUECHERRY_LINUX_GROUP_NAME \ + && /usr/sbin/useradd -rm \ + --comment "Bluecherry DVR" \ + --home-dir=/var/lib/bluecherry \ + --gid=$BLUECHERRY_LINUX_GROUP_NAME \ + --groups=audio,video,render \ + --uid=$BLUECHERRY_LINUX_USER_ID \ + $BLUECHERRY_LINUX_USER_NAME \ + || echo "bluecherry user already exists" + +RUN mkdir /recordings \ + && chown bluecherry:bluecherry /recordings + +EXPOSE 7001/tcp 7002/tcp + +# This is the main script that runs as process ID 1 in the docker container +#COPY server/entrypoint.sh /entrypoint.sh + +# These scripts are wrappers used to manage the bluecherry database. They are +# necessary because the bluecherry installer usually sets up the database, but +# with a pre-built docker image the installer isn't run (so these actions have +# to be done manually as needed from the docker container... example usage +# from the docker host looks like: +# +# --- CREATE: sudo docker-compose run bluecherry bc-database-create +# --- UPGRADE: sudo docker-compose run bluecherry bc-database-upgrade +#COPY server/bc-database-create.sh /bin/bc-database-create +#COPY server/bc-database-upgrade.sh /bin/bc-database-upgrade + +# This copies in a modified rsyslog config, which tells rsyslog to route +# bluecherry logs to both /var/log/bluecherry.log (within the container) and +# also to the STDOUT of container process with PID 1, which then allows the +# logs to be received by the docker engine (and read via `docker logs` , etc.) +#COPY server/bc-rsyslog.conf /etc/rsyslog.d/10-bluecherry.conf + + + + +#ARG BLUECHERRY_GIT_BRANCH_TAG=v3.0.4 + +#FROM os_dev_environment as bluecherry_build_cleaned +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +RUN rm -rf /usr/src/linux-headers-* + + +# This is the main script that runs as process ID 1 in the docker container +COPY ./server/entrypoint.sh /entrypoint.sh + +# These scripts are wrappers used to manage the bluecherry database. They are +# necessary because the bluecherry installer usually sets up the database, but +# with a pre-built docker image the installer isn't run (so these actions have +# to be done manually as needed from the docker container... example usage +# from the docker host looks like: +# +# --- CREATE: sudo docker-compose run bluecherry bc-database-create +# --- UPGRADE: sudo docker-compose run bluecherry bc-database-upgrade +COPY server/bc-database-create.sh /bin/bc-database-create +COPY server/bc-database-upgrade.sh /bin/bc-database-upgrade + +# This copies in a modified rsyslog config, which tells rsyslog to route +# bluecherry logs to both /var/log/bluecherry.log (within the container) and +# also to the STDOUT of container process with PID 1, which then allows the +# logs to be received by the docker engine (and read via `docker logs` , etc.) +RUN ls -l /etc/rsyslog.d +COPY ./server/bc-rsyslog.conf /etc/rsyslog.d/10-bluecherry.conf + +# Make the previously copied scripts executable +RUN chmod +x /entrypoint.sh \ + && chmod +x /bin/bc-database-create \ + && chmod +x /bin/bc-database-upgrade + +CMD "/entrypoint.sh" diff --git a/docker-compose.yml b/docker-compose.yml index 09033f06..27ab2a35 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: TZ: $TZ bluecherry: - image: bluecherrydvr/bluecherry:latest + image: bluecherrydvr/bluecherry:citesting container_name: bc-server cap_add: - NET_BIND_SERVICE diff --git a/server/Dockerfile b/server/Dockerfile index fb66885f..9a49b5bc 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -4,7 +4,7 @@ FROM ubuntu:20.04 AS baseos #ARG DB_HOST=$BLUECHERRY_DB_HOST #RUN echo $BLUECHERRY_DB_HOST -ARG BLUECHERRY_GIT_BRANCH_TAG=v3.1.0-rc8 +ARG BLUECHERRY_GIT_BRANCH_TAG=v3.1.0-latest #ARG MYSQLHOST #ENV MYSQL_HOST=MYSQLHOST @@ -22,7 +22,7 @@ CMD ["echo", "Testing mysql connection via nmap..."] RUN apt-get update RUN apt-get -y install nmap -RUN nmap $BLUECHERRY_DB_HOST -p 3306 +#RUN nmap mysql -p 3306 CMD ["echo", "Installing other stuff..."] @@ -41,11 +41,11 @@ CMD ["echo", "Testing mysql connection..."] RUN apt install -y mysql-client #RUN ip a -RUN mysql -uroot -proot -h$BLUECHERRY_DB_HOST -e 'SELECT version()' - +RUN mysql -uroot -proot -h 172.17.0.1 -e 'SELECT version()' + # --------------------------------------------------------------------------- -FROM os_dev_environment as bluecherry_base_environment +#FROM os_dev_environment as bluecherry_base_environment ENV DEBIAN_FRONTEND=noninteractive WORKDIR /root @@ -104,7 +104,7 @@ RUN rm -rf .ccache \ # --------------------------------------------------------------------------- # Install the bluecherry app and dependencies -FROM baseos as bluecherry_install +#FROM baseos as bluecherry_install ENV DEBIAN_FRONTEND=noninteractive WORKDIR /root @@ -116,7 +116,7 @@ RUN apt update # php-net-smtp sqlite3 nginx php-fpm php-mysql php-sqlite3 v4l-utils vainfo i965-va-driver php-gd php-curl mariadb-client python3-pip python3-distutils gnupg2 RUN apt install --no-install-recommends -y libbsd0 libc6 libgcc-s1 libmariadb3 libopencv-core4.2 libopencv-imgcodecs4.2 libopencv-imgproc4.2 curl \ libssl1.1 libstdc++6 libudev1 libva-drm2 libva2 zlib1g ssl-cert ucf curl sysstat mkvtoolnix php-mail \ - php-mail-mime php-net-smtp sqlite3 nmap nginx php-fpm php-mysql php-sqlite3 v4l-utils vainfo i965-va-driver + php-mail-mime php-net-smtp sqlite3 nmap nginx php-fpm php-mysql php-sqlite3 v4l-utils vainfo i965-va-driver mysql-client python3-pip @@ -138,10 +138,10 @@ ARG MYSQL_ADMIN_PASSWORD=root # Specific database credentials used by bluecherry server ARG BLUECHERRY_DB_USER=bluecherry -ARG BLUECHERRY_DB_HOST=127.0.0.1 +ARG BLUECHERRY_DB_HOST=172.17.0.1 ARG BLUECHERRY_DB_PASSWORD=qiNdklOierSZs2 ARG BLUECHERRY_DB_NAME=bluecherry -ARG BLUECHERRY_DB_ACCESS_HOST=% +ARG BLUECHERRY_DB_ACCESS_HOST='%' # User and Group info used for running bluecherry server processes ARG BLUECHERRY_LINUX_GROUP_NAME=bluecherry @@ -232,7 +232,7 @@ RUN /usr/sbin/groupadd -rf \ --comment "Bluecherry DVR" \ --home-dir=/var/lib/bluecherry \ --gid=$BLUECHERRY_LINUX_GROUP_NAME \ - --groups=audio,video \ + --groups=audio,video,render \ --uid=$BLUECHERRY_LINUX_USER_ID \ $BLUECHERRY_LINUX_USER_NAME \ || echo "bluecherry user already exists" @@ -243,7 +243,7 @@ RUN mkdir /recordings \ EXPOSE 7001/tcp 7002/tcp # This is the main script that runs as process ID 1 in the docker container -COPY entrypoint.sh /entrypoint.sh +#COPY server/entrypoint.sh /entrypoint.sh # These scripts are wrappers used to manage the bluecherry database. They are # necessary because the bluecherry installer usually sets up the database, but @@ -253,199 +253,26 @@ COPY entrypoint.sh /entrypoint.sh # # --- CREATE: sudo docker-compose run bluecherry bc-database-create # --- UPGRADE: sudo docker-compose run bluecherry bc-database-upgrade -COPY bc-database-create.sh /bin/bc-database-create -COPY bc-database-upgrade.sh /bin/bc-database-upgrade +#COPY server/bc-database-create.sh /bin/bc-database-create +#COPY server/bc-database-upgrade.sh /bin/bc-database-upgrade # This copies in a modified rsyslog config, which tells rsyslog to route # bluecherry logs to both /var/log/bluecherry.log (within the container) and # also to the STDOUT of container process with PID 1, which then allows the # logs to be received by the docker engine (and read via `docker logs` , etc.) -COPY bc-rsyslog.conf /etc/rsyslog.d/10-bluecherry.conf +#COPY server/bc-rsyslog.conf /etc/rsyslog.d/10-bluecherry.conf -# Make the previously copied scripts executable -RUN chmod +x /entrypoint.sh \ - && chmod +x /bin/bc-database-create \ - && chmod +x /bin/bc-database-upgrade -CMD "/entrypoint.sh" #ARG BLUECHERRY_GIT_BRANCH_TAG=v3.0.4 - -# --------------------------------------------------------------------------- -# Build the base OS with some development libs and tools -FROM baseos AS os_dev_environment -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /root - -RUN apt-get update - -RUN apt-get install --no-install-recommends -y \ - git sudo openssl ca-certificates wget gnupg gnupg2 gnupg1 \ - ssl-cert nmap curl sysstat iproute2 \ - autoconf automake libtool build-essential gcc g++ \ - debhelper ccache bison flex texinfo yasm cmake - -RUN apt-get install --no-install-recommends -y \ - libbsd-dev libopencv-dev libudev-dev libva-dev \ - linux-image-generic linux-headers-generic \ - libmysqlclient-dev rsyslog - - -# --------------------------------------------------------------------------- -FROM os_dev_environment as bluecherry_base_environment -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /root - -RUN git clone --progress --depth 1 \ - http://github.com/bluecherrydvr/bluecherry-apps.git \ - && cd bluecherry-apps \ - && git checkout $BLUECHERRY_GIT_BRANCH_TAG - -RUN apt-get --no-install-recommends -y install \ - libbsd0 libc6 libgcc1 libssl1.1 libstdc++6 libudev1 \ - zlib1g ucf mkvtoolnix v4l-utils vainfo i965-va-driver - -RUN apt-get --no-install-recommends -y install \ - php-mail php-mail-mime php-net-smtp php-gd php-curl \ - php-mysql php-sqlite3 \ -# apache2 libapache2-mod-php mysql-client sqlite3 - nginx default-mysql-client sqlite3 - -# --------------------------------------------------------------------------- -# Build the bluecherry app and dependencies. This is done in a separate -# image because there are many ways it can fail and then we save time -# by being able to reuse prior containers leading up to this build. -FROM bluecherry_base_environment as bluecherry_build -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /root - -COPY depends/onvif_tool bluecherry-apps/utils/onvif_tool - -RUN cd bluecherry-apps \ - && ./scripts/build_pkg_native.sh - - -# --------------------------------------------------------------------------- -FROM bluecherry_build as bluecherry_build_cleaned +#FROM os_dev_environment as bluecherry_build_cleaned ENV DEBIAN_FRONTEND=noninteractive WORKDIR /root RUN rm -rf /usr/src/linux-headers-* -RUN rm -rf .ccache \ - && rm -rf bluecherry-apps/.git \ - && rm -rf bluecherry-apps/misc/libav \ - && rm -rf bluecherry-apps/misc/libconfig \ - && rm -rf bluecherry-apps/misc/pugixml - - -# --------------------------------------------------------------------------- -# Install the bluecherry app and dependencies -FROM baseos as bluecherry_install -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /root - -COPY --from=bluecherry_build_cleaned \ - /root/bluecherry-apps/releases/bluecherry_*.deb \ - /root/bluecherry-apps/releases/ - -# This step is needed if/when building a new bluecherry docker container -# that will connect to an existing bluecherry database. In this case, the -# bluecherry installer will see the existing database, and it needs the -# /etc/bluecherry.conf file to tell it that it is okay to connect to (and -# modify) that database -# -COPY bluecherry.conf /etc/bluecherry.conf - -ARG MYSQL_ADMIN_LOGIN=root -ARG MYSQL_ADMIN_PASSWORD - -# Specific database credentials used by bluecherry server -ARG BLUECHERRY_DB_USER=bluecherry -ARG BLUECHERRY_DB_HOST=mysql -ARG BLUECHERRY_DB_PASSWORD=bluecherry -ARG BLUECHERRY_DB_NAME=bluecherry -ARG BLUECHERRY_DB_ACCESS_HOST=% - -# User and Group info used for running bluecherry server processes -ARG BLUECHERRY_LINUX_GROUP_NAME=bluecherry -ARG BLUECHERRY_LINUX_GROUP_ID=1000 -ARG BLUECHERRY_LINUX_USER_NAME=bluecherry -ARG BLUECHERRY_LINUX_USER_ID=1000 - -RUN apt-get update \ - && apt-get install -y \ - rsyslog nmap curl sysstat iproute2 \ - openssl ca-certificates ssl-cert gnupg gnupg2 gnupg1 - -RUN { \ - echo "[client]"; \ - echo "user=$MYSQL_ADMIN_LOGIN"; \ - echo "password=$MYSQL_ADMIN_PASSWORD"; \ - echo "[mysql]"; \ - echo "user=$MYSQL_ADMIN_LOGIN"; \ - echo "password=$MYSQL_ADMIN_PASSWORD"; \ - echo "[mysqldump]"; \ - echo "user=$MYSQL_ADMIN_LOGIN"; \ - echo "password=$MYSQL_ADMIN_PASSWORD"; \ - echo "[mysqldiff]"; \ - echo "user=$MYSQL_ADMIN_LOGIN"; \ - echo "password=$MYSQL_ADMIN_PASSWORD"; \ - } > /root/.my.cnf - -# NOTE: The line "export host=$BLUECHERRY_DB_HOST" ... This is required -# due to a weird global check of this env var by the "check_mysql_admin" -# function in /usr/share/bluecherry/bc_db_tool.sh ... which doesn't accept -# the db host as an argument like most of the other functions in that file. -# --- The Specific problem line is: -# if ! echo "show databases" | mysql_wrapper -h"${host}" -u"$MYSQL_ADMIN_LOGIN" &>/dev/null -# -RUN { \ - echo bluecherry bluecherry/mysql_admin_login string $MYSQL_ADMIN_LOGIN; \ - echo bluecherry bluecherry/mysql_admin_password password $MYSQL_ADMIN_PASSWORD; \ - echo bluecherry bluecherry/db_host string $BLUECHERRY_DB_HOST; \ - echo bluecherry bluecherry/db_userhost string $BLUECHERRY_DB_ACCESS_HOST; \ - echo bluecherry bluecherry/db_name string $BLUECHERRY_DB_NAME; \ - echo bluecherry bluecherry/db_user string $BLUECHERRY_DB_USER; \ - echo bluecherry bluecherry/db_password password $BLUECHERRY_DB_PASSWORD; \ - } | debconf-set-selections \ - && export host=$BLUECHERRY_DB_HOST \ - && apt install -y ./bluecherry-apps/releases/bluecherry_*.deb - -# Cleanup tasks -RUN apt-get clean \ - && rm -f bluecherry-apps/releases/bluecherry_*.deb \ - && rm -rf /var/lib/apt/lists/* - -# Remove these files -- we needed them to build the docker image, since the -# bluecherry installer scripts interact with the database. However, once the -# image is created, we expect it to receive all of the settings/credentials -# from environment variables passed in by docker or docker-compose. -RUN rm -f /root/.my.cnf \ - && rm -f /etc/bluecherry.conf - -# When running rsyslog in a container, we need to disable imklog -# since the in-container process won't be allowed access to it. -RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf - -RUN /usr/sbin/groupadd -rf \ - --gid=$BLUECHERRY_LINUX_GROUP_ID \ - $BLUECHERRY_LINUX_GROUP_NAME \ - && /usr/sbin/useradd -rm \ - --comment "Bluecherry DVR" \ - --home-dir=/var/lib/bluecherry \ - --gid=$BLUECHERRY_LINUX_GROUP_NAME \ - --groups=audio,video \ - --uid=$BLUECHERRY_LINUX_USER_ID \ - $BLUECHERRY_LINUX_USER_NAME \ - || echo "bluecherry user already exists" - -RUN mkdir /recordings \ - && chown bluecherry:bluecherry /recordings - -EXPOSE 7001/tcp 7002/tcp 554/tcp 554/udp # This is the main script that runs as process ID 1 in the docker container COPY entrypoint.sh /entrypoint.sh @@ -465,6 +292,7 @@ COPY bc-database-upgrade.sh /bin/bc-database-upgrade # bluecherry logs to both /var/log/bluecherry.log (within the container) and # also to the STDOUT of container process with PID 1, which then allows the # logs to be received by the docker engine (and read via `docker logs` , etc.) +RUN ls -ltrd /etc/rsyslog.d COPY bc-rsyslog.conf /etc/rsyslog.d/10-bluecherry.conf # Make the previously copied scripts executable diff --git a/server/Dockerfile-working b/server/Dockerfile-working new file mode 100644 index 00000000..9a49b5bc --- /dev/null +++ b/server/Dockerfile-working @@ -0,0 +1,303 @@ +# set a base image with environment to build from +FROM ubuntu:20.04 AS baseos +#RUN echo $DB_HOST +#ARG DB_HOST=$BLUECHERRY_DB_HOST +#RUN echo $BLUECHERRY_DB_HOST + +ARG BLUECHERRY_GIT_BRANCH_TAG=v3.1.0-latest +#ARG MYSQLHOST +#ENV MYSQL_HOST=MYSQLHOST + +#RUN echo "Testing github network env" +#RUN echo ${{ steps.github-network.outputs.gateway-address }} +RUN echo $MYSQL_HOST + +# --------------------------------------------------------------------------- +# Build the base OS with some development libs and tools +FROM baseos AS os_dev_environment +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +CMD ["echo", "Testing mysql connection via nmap..."] + +RUN apt-get update +RUN apt-get -y install nmap +#RUN nmap mysql -p 3306 + +CMD ["echo", "Installing other stuff..."] + +#RUN apt-get install --no-install-recommends -y \ +# git sudo openssl ca-certificates wget gnupg gnupg2 gnupg1 \ +# ssl-cert nmap curl sysstat iproute2 \ +# autoconf automake libtool build-essential gcc g++ \ +# debhelper ccache bison flex texinfo yasm cmake + +#RUN apt-get install --no-install-recommends -y \ +# libbsd-dev libopencv-dev libudev-dev libva-dev \ +# linux-image-generic linux-headers-generic \ +# libmysqlclient-dev rsyslog + +CMD ["echo", "Testing mysql connection..."] + +RUN apt install -y mysql-client +#RUN ip a +RUN mysql -uroot -proot -h 172.17.0.1 -e 'SELECT version()' + + +# --------------------------------------------------------------------------- +#FROM os_dev_environment as bluecherry_base_environment +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +#RUN git clone --progress --depth 1 \ +# http://github.com/bluecherrydvr/bluecherry-apps.git \ +# && cd bluecherry-apps \ +# && git checkout $BLUECHERRY_GIT_BRANCH_TAG + +#RUN apt-get --no-install-recommends -y install \ +# libbsd0 libc6 libgcc1 libssl1.1 libstdc++6 libudev1 \ +# zlib1g ucf mkvtoolnix v4l-utils vainfo i965-va-driver + +CMD ["echo", "**************** NMAP output..."] +RUN apt-get update +RUN apt-get -y install nmap +RUN nmap 127.0.0.1 -p 3306 + +CMD ["echo", "Installing other stuff..."] + +RUN apt install -y --no-install-recommends wget sudo gnupg +#RUN wget -q https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 -O- | apt-key add - +RUN apt update + +#RUN apt-get --no-install-recommends -y install \ +# php-mail php-mail-mime php-net-smtp php-gd php-curl \ +# php-mysql php-sqlite3 \ +# mysql-client sqlite3 + +# --------------------------------------------------------------------------- +# Build the bluecherry app and dependencies. This is done in a separate +# image because there are many ways it can fail and then we save time +# by being able to reuse prior containers leading up to this build. +#FROM bluecherry_base_environment as bluecherry_build +#ENV DEBIAN_FRONTEND=noninteractive +#WORKDIR /root + +#COPY depends/onvif_tool bluecherry-apps/utils/onvif_tool + +#RUN cd bluecherry-apps \ +# && ./scripts/build_pkg_native.sh + + +# --------------------------------------------------------------------------- +#FROM bluecherry_build as bluecherry_build_cleaned +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +RUN rm -rf /usr/src/linux-headers-* + +RUN rm -rf .ccache \ + && rm -rf bluecherry-apps/.git \ + && rm -rf bluecherry-apps/misc/libav \ + && rm -rf bluecherry-apps/misc/libconfig \ + && rm -rf bluecherry-apps/misc/pugixml + + +# --------------------------------------------------------------------------- +# Install the bluecherry app and dependencies +#FROM baseos as bluecherry_install +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +#COPY --from=bluecherry_build_cleaned \ +# /root/bluecherry-apps/releases/bluecherry_*.deb \ +# /root/bluecherry-apps/releases/ +RUN apt update +#RUN apt install --no-install-recommends -y wget mariadb-client libopencv-core libopencv-imgcodecs libopencv-imgproc libva-drm2 libva2 mkvtoolnix php-mail php-mail-mime \# +# php-net-smtp sqlite3 nginx php-fpm php-mysql php-sqlite3 v4l-utils vainfo i965-va-driver php-gd php-curl mariadb-client python3-pip python3-distutils gnupg2 +RUN apt install --no-install-recommends -y libbsd0 libc6 libgcc-s1 libmariadb3 libopencv-core4.2 libopencv-imgcodecs4.2 libopencv-imgproc4.2 curl \ + libssl1.1 libstdc++6 libudev1 libva-drm2 libva2 zlib1g ssl-cert ucf curl sysstat mkvtoolnix php-mail \ + php-mail-mime php-net-smtp sqlite3 nmap nginx php-fpm php-mysql php-sqlite3 v4l-utils vainfo i965-va-driver mysql-client python3-pip + + + +#RUN wget https://unstable.bluecherrydvr.com/pool/focal/bluecherry_3.1.0-rc8_amd64.deb +RUN curl -k -o /tmp/bluecherry_3.1.0-rc8_amd64.deb https://unstable.bluecherrydvr.com/pool/focal/bluecherry_3.1.0-rc8_amd64.deb + +#COPY depends/bluecherry_3.1.0-rc8_amd64.deb /tmp/bluecherry_3.1.0-rc8_amd64.deb + +# This step is needed if/when building a new bluecherry docker container +# that will connect to an existing bluecherry database. In this case, the +# bluecherry installer will see the existing database, and it needs the +# /etc/bluecherry.conf file to tell it that it is okay to connect to (and +# modify) that database +# +#COPY bluecherry.conf /etc/bluecherry.conf + +ARG MYSQL_ADMIN_LOGIN=root +ARG MYSQL_ADMIN_PASSWORD=root + +# Specific database credentials used by bluecherry server +ARG BLUECHERRY_DB_USER=bluecherry +ARG BLUECHERRY_DB_HOST=172.17.0.1 +ARG BLUECHERRY_DB_PASSWORD=qiNdklOierSZs2 +ARG BLUECHERRY_DB_NAME=bluecherry +ARG BLUECHERRY_DB_ACCESS_HOST='%' + +# User and Group info used for running bluecherry server processes +ARG BLUECHERRY_LINUX_GROUP_NAME=bluecherry +ARG BLUECHERRY_LINUX_GROUP_ID=1000 +ARG BLUECHERRY_LINUX_USER_NAME=bluecherry +ARG BLUECHERRY_LINUX_USER_ID=1000 + +RUN apt-get update \ + && apt-get install -y \ + wget sudo rsyslog nmap curl sysstat iproute2 \ + openssl ca-certificates ssl-cert gnupg gnupg2 gnupg1 + +#COPY my.cnf /root/.my.cnf + +#RUN { \ +# echo "[client]"; \ +# echo "user=$MYSQL_ADMIN_LOGIN"; \ +# echo "password=$MYSQL_ADMIN_PASSWORD"; \ +# echo "[mysql]"; \ +# echo "user=$MYSQL_ADMIN_LOGIN"; \ +# echo "password=$MYSQL_ADMIN_PASSWORD"; \ +# echo "[mysqldump]"; \ +# echo "user=$MYSQL_ADMIN_LOGIN"; \ +# echo "password=$MYSQL_ADMIN_PASSWORD"; \ +# echo "[mysqldiff]"; \ +# echo "user=$MYSQL_ADMIN_LOGIN"; \ +# echo "password=$MYSQL_ADMIN_PASSWORD"; \ +# } > /root/.my.cnf + +# NOTE: The line "export host=$BLUECHERRY_DB_HOST" ... This is required +# due to a weird global check of this env var by the "check_mysql_admin" +# function in /usr/share/bluecherry/bc_db_tool.sh ... which doesn't accept +# the db host as an argument like most of the other functions in that file. +# --- The Specific problem line is: +# if ! echo "show databases" | mysql_wrapper -h"${host}" -u"$MYSQL_ADMIN_LOGIN" &>/dev/null +# +#RUN { \ +# echo bluecherry bluecherry/mysql_admin_login string $MYSQL_ADMIN_LOGIN; \ +# echo bluecherry bluecherry/mysql_admin_password password $MYSQL_ADMIN_PASSWORD; \ +# echo bluecherry bluecherry/db_host string $BLUECHERRY_DB_HOST; \ +## echo bluecherry bluecherry/db_host string mysql \ +# echo bluecherry bluecherry/db_userhost string $BLUECHERRY_DB_ACCESS_HOST; \ +# echo bluecherry bluecherry/db_name string $BLUECHERRY_DB_NAME; \ +# echo bluecherry bluecherry/db_user string $BLUECHERRY_DB_USER; \ +# echo bluecherry bluecherry/db_password password $BLUECHERRY_DB_PASSWORD; \ +# } | debconf-set-selections \ +# && export host=mysql \ +# && export host=$BLUECHERRY_DB_HOST \ +# && dpkg -i /tmp/bluecherry_3.1.0-rc8_amd64.deb + +RUN apt install -y php-curl php-gd + +RUN { \ + echo bluecherry bluecherry/mysql_admin_login string $MYSQL_ADMIN_LOGIN; \ + echo bluecherry bluecherry/mysql_admin_password password $MYSQL_ADMIN_PASSWORD; \ + echo bluecherry bluecherry/db_host string $BLUECHERRY_DB_HOST; \ + echo bluecherry bluecherry/db_userhost string $BLUECHERRY_DB_ACCESS_HOST; \ + echo bluecherry bluecherry/db_name string $BLUECHERRY_DB_NAME; \ + echo bluecherry bluecherry/db_user string $BLUECHERRY_DB_USER; \ + echo bluecherry bluecherry/db_password password $BLUECHERRY_DB_PASSWORD; \ + } | debconf-set-selections \ +# && export DB_HOST="mysql" \ +# && export HOST=mysql \ +&& dpkg -i /tmp/bluecherry_3.1.0-rc8_amd64.deb + + + +# Cleanup tasks +RUN apt-get clean \ +# && rm -f bluecherry-apps/releases/bluecherry_*.deb \ + && rm -rf /var/lib/apt/lists/* + +# Remove these files -- we needed them to build the docker image, since the +# bluecherry installer scripts interact with the database. However, once the +# image is created, we expect it to receive all of the settings/credentials +# from environment variables passed in by docker or docker-compose. +#RUN rm -f /root/.my.cnf \ +RUN rm -f /etc/bluecherry.conf + +# When running rsyslog in a container, we need to disable imklog +# since the in-container process won't be allowed access to it. +RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf + +RUN /usr/sbin/groupadd -rf \ + --gid=$BLUECHERRY_LINUX_GROUP_ID \ + $BLUECHERRY_LINUX_GROUP_NAME \ + && /usr/sbin/useradd -rm \ + --comment "Bluecherry DVR" \ + --home-dir=/var/lib/bluecherry \ + --gid=$BLUECHERRY_LINUX_GROUP_NAME \ + --groups=audio,video,render \ + --uid=$BLUECHERRY_LINUX_USER_ID \ + $BLUECHERRY_LINUX_USER_NAME \ + || echo "bluecherry user already exists" + +RUN mkdir /recordings \ + && chown bluecherry:bluecherry /recordings + +EXPOSE 7001/tcp 7002/tcp + +# This is the main script that runs as process ID 1 in the docker container +#COPY server/entrypoint.sh /entrypoint.sh + +# These scripts are wrappers used to manage the bluecherry database. They are +# necessary because the bluecherry installer usually sets up the database, but +# with a pre-built docker image the installer isn't run (so these actions have +# to be done manually as needed from the docker container... example usage +# from the docker host looks like: +# +# --- CREATE: sudo docker-compose run bluecherry bc-database-create +# --- UPGRADE: sudo docker-compose run bluecherry bc-database-upgrade +#COPY server/bc-database-create.sh /bin/bc-database-create +#COPY server/bc-database-upgrade.sh /bin/bc-database-upgrade + +# This copies in a modified rsyslog config, which tells rsyslog to route +# bluecherry logs to both /var/log/bluecherry.log (within the container) and +# also to the STDOUT of container process with PID 1, which then allows the +# logs to be received by the docker engine (and read via `docker logs` , etc.) +#COPY server/bc-rsyslog.conf /etc/rsyslog.d/10-bluecherry.conf + + + + +#ARG BLUECHERRY_GIT_BRANCH_TAG=v3.0.4 + +#FROM os_dev_environment as bluecherry_build_cleaned +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /root + +RUN rm -rf /usr/src/linux-headers-* + + +# This is the main script that runs as process ID 1 in the docker container +COPY entrypoint.sh /entrypoint.sh + +# These scripts are wrappers used to manage the bluecherry database. They are +# necessary because the bluecherry installer usually sets up the database, but +# with a pre-built docker image the installer isn't run (so these actions have +# to be done manually as needed from the docker container... example usage +# from the docker host looks like: +# +# --- CREATE: sudo docker-compose run bluecherry bc-database-create +# --- UPGRADE: sudo docker-compose run bluecherry bc-database-upgrade +COPY bc-database-create.sh /bin/bc-database-create +COPY bc-database-upgrade.sh /bin/bc-database-upgrade + +# This copies in a modified rsyslog config, which tells rsyslog to route +# bluecherry logs to both /var/log/bluecherry.log (within the container) and +# also to the STDOUT of container process with PID 1, which then allows the +# logs to be received by the docker engine (and read via `docker logs` , etc.) +RUN ls -ltrd /etc/rsyslog.d +COPY bc-rsyslog.conf /etc/rsyslog.d/10-bluecherry.conf + +# Make the previously copied scripts executable +RUN chmod +x /entrypoint.sh \ + && chmod +x /bin/bc-database-create \ + && chmod +x /bin/bc-database-upgrade + +CMD "/entrypoint.sh" diff --git a/server/entrypoint.sh b/server/entrypoint.sh index 20f03493..4464b877 100644 --- a/server/entrypoint.sh +++ b/server/entrypoint.sh @@ -55,20 +55,62 @@ echo "> /usr/sbin/rsyslogd" /usr/sbin/rsyslogd status=$? if [ $status -ne 0 ]; then - echo "Failed to start apache2 web server: $status" + echo "Failed to start rsyslog: $status" exit $status fi +entrypoint_log() { + if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then + echo "$@" + fi +} -echo "> /usr/sbin/apache2" -source /etc/apache2/envvars -/usr/sbin/apache2 -status=$? -if [ $status -ne 0 ]; then - echo "Failed to start apache2 web server: $status" - exit $status +if [ "$1" = "nginx" ] || [ "$1" = "nginx-debug" ]; then + if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then + entrypoint_log "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration" + + entrypoint_log "$0: Looking for shell scripts in /docker-entrypoint.d/" + find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do + case "$f" in + *.envsh) + if [ -x "$f" ]; then + entrypoint_log "$0: Sourcing $f"; + . "$f" + else + # warn on shell scripts without exec bit + entrypoint_log "$0: Ignoring $f, not executable"; + fi + ;; + *.sh) + if [ -x "$f" ]; then + entrypoint_log "$0: Launching $f"; + "$f" + else + # warn on shell scripts without exec bit + entrypoint_log "$0: Ignoring $f, not executable"; + fi + ;; + *) entrypoint_log "$0: Ignoring $f";; + esac + done + + entrypoint_log "$0: Configuration complete; ready for start up" + else + entrypoint_log "$0: No files found in /docker-entrypoint.d/, skipping configuration" + fi fi +exec "$@" + +#echo "> /usr/sbin/nginx" +#source /etc/apache2/envvars +#/usr/sbin/apache2 +#status=$? +#if [ $status -ne 0 ]; then +# echo "Failed to start apache2 web server: $status" +# exit $status +#fi + echo "> /usr/sbin/bc-server -u bluecherry -g bluecherry" export LD_LIBRARY_PATH=/usr/lib/bluecherry