Skip to content

Commit

Permalink
Base php 7.4 (#1812)
Browse files Browse the repository at this point in the history
This is a PR to update the base-php image to 7.4. We will not update to future PHP versions, so it makes sense to just name this base-php

We also add the mongodb-org-tools apt package to the base-php image for use in the backup/restore planned task.
  • Loading branch information
megahirt authored May 20, 2024
1 parent 9479df3 commit 0194f27
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-publish-base-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 .
Empty file added build.log
Empty file.
12 changes: 5 additions & 7 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions docker/base-php/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
2 changes: 0 additions & 2 deletions docker/composer-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
6 changes: 2 additions & 4 deletions docker/test-php/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0194f27

Please sign in to comment.