diff --git a/.github/workflows/build-and-publish-base-php.yml b/.github/workflows/build-and-publish-base-php.yml index 4910314f52..b742ad86b4 100644 --- a/.github/workflows/build-and-publish-base-php.yml +++ b/.github/workflows/build-and-publish-base-php.yml @@ -19,7 +19,7 @@ jobs: - uses: docker/setup-buildx-action@v2 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 - name: Log in to Docker Hub uses: docker/login-action@v2 @@ -28,4 +28,4 @@ jobs: password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} - name: Build, tag and push image - run: docker buildx build --push --platform linux/amd64,linux/arm64 -t ${{ env.IMAGE }} -f docker/base-php/Dockerfile . + run: docker buildx build --push --platform linux/amd64 -t ${{ env.IMAGE }} -f docker/base-php/Dockerfile . diff --git a/build.log b/build.log new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 8125b287fc..adc0ddb177 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -38,24 +38,22 @@ RUN npm run build:${NPM_BUILD_SUFFIX} # COMPOSER-BUILDER # download composer app dependencies # git - needed for composer install -FROM sillsdev/web-languageforge:base-php-7.4 AS composer-builder +FROM sillsdev/web-languageforge:base-php AS composer-builder ENV COMPOSER_ALLOW_SUPERUSER=1 -RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* \ - && install-php-extensions @composer WORKDIR /composer COPY src/composer.json src/composer.lock /composer/ RUN composer install # PRODUCTION IMAGE -FROM sillsdev/web-languageforge:base-php-7.4 AS production-app -RUN rm /usr/local/bin/install-php-extensions -RUN apt-get remove -y gnupg2 +FROM sillsdev/web-languageforge:base-php AS production-app +RUN rm /usr/local/bin/install-php-extensions /usr/local/bin/composer +RUN apt-get remove -y gnupg2 git RUN mv $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini # had to add /wait into prod image so the prod image could be run through E2E tests. COPY --from=sillsdev/web-languageforge:wait-latest /wait /wait # DEVELOPMENT IMAGE -FROM sillsdev/web-languageforge:base-php-7.4 AS development-app +FROM sillsdev/web-languageforge:base-php AS development-app RUN install-php-extensions xdebug-^3.1 COPY docker/app/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d RUN mv $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini diff --git a/docker/base-php/Dockerfile b/docker/base-php/Dockerfile index b3de5dfeb4..4703f2b514 100644 --- a/docker/base-php/Dockerfile +++ b/docker/base-php/Dockerfile @@ -1,16 +1,27 @@ -FROM php:7.3.28-apache +# This image is based on debian 11 bullseye +# https://hub.docker.com/layers/library/php/7.4-apache/images/sha256-c44681664d111addef2a2b6598901609990d45047b874c87d7d40fc7ce269195 +FROM php:7.4-apache # install apt packages +# gnupg - for installing Mongo GPG key below +# git - for use by composer to install dependencies # p7zip-full - used by LF application for unzipping lexicon uploads # unzip - used by LF application for unzipping lexicon uploads # curl - used by LF application # ffmpeg - used by LF audio upload method -RUN apt-get update && apt-get -y install p7zip-full unzip curl tini ffmpeg && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get -y install gnupg git p7zip-full unzip curl tini ffmpeg + +# Install MongoDB shell and tools (must be done after gnupg is installed) +# mongodb-org-tools - contains mongoimport/mongoexport used by LF backup/restore project commands +# mongodb-mongosh - contains mongosh which is useful for querying the db from the app container +RUN curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc | gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor +RUN echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list +RUN apt-get update && apt-get -y install mongodb-org-tools mongodb-mongosh && rm -rf /var/lib/apt/lists/* # see https://github.com/mlocati/docker-php-extension-installer # PHP extensions required by the LF application COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ -RUN install-php-extensions mongodb intl +RUN install-php-extensions mongodb intl @composer # php customizations COPY docker/base-php/customizations.php.ini $PHP_INI_DIR/conf.d/ diff --git a/docker/composer-dev/Dockerfile b/docker/composer-dev/Dockerfile index 80bb5a3c9b..f891fc5cbf 100644 --- a/docker/composer-dev/Dockerfile +++ b/docker/composer-dev/Dockerfile @@ -3,8 +3,6 @@ FROM sillsdev/web-languageforge:base-php WORKDIR /work ENV COMPOSER_ALLOW_SUPERUSER=1 -RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* \ - && install-php-extensions @composer COPY src/composer.json src/composer.lock /work/ CMD ["bash"] diff --git a/docker/test-php/Dockerfile b/docker/test-php/Dockerfile index b93f83d233..77bda5efe7 100644 --- a/docker/test-php/Dockerfile +++ b/docker/test-php/Dockerfile @@ -1,15 +1,13 @@ -FROM sillsdev/web-languageforge:base-php-7.4 +FROM sillsdev/web-languageforge:base-php # ----- LINES BELOW COPIED FROM APP DOCKERFILE ---------- WORKDIR /var/www/html ENV COMPOSER_ALLOW_SUPERUSER=1 -RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* \ - && install-php-extensions @composer COPY src/composer.json src/composer.lock /var/www/html/ RUN composer install -RUN install-php-extensions xdebug +RUN install-php-extensions xdebug-^3.1 COPY docker/app/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d RUN mv $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini