Skip to content

Commit

Permalink
EDIT docker update and cleanup
Browse files Browse the repository at this point in the history
Composer 2.7 is out, instead of pinning our version to a specific minor
version, it's probably safe to just pin our version to major version 2.

composer's '--no-suggest' option is deprecated and does nothing now, so
it was removed.

Updated mariadb to 10.11 LTS.

Added adminer as a front-end UI for mariadb to help with dev.

Removed zend extension opcache.so as the version is very old and doesn't
seem necessary.

Removed container names as docker compose best practice is not to use
them.
  • Loading branch information
ionparticle committed Jul 12, 2024
1 parent ec9c8d4 commit bddc00d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
&& pecl install timezonedb xdebug\
&& docker-php-ext-enable timezonedb xdebug

COPY --from=composer:2.6 /usr/bin/composer /usr/local/bin/composer
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer

COPY docker/php.ini /usr/local/etc/php/
COPY . /var/www/html
COPY docker/docker-entrypoint-php-fpm.sh /

RUN cd /var/www/html \
&& composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --no-suggest --optimize-autoloader \
&& composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --optimize-autoloader \
&& mkdir -p /var/www/html/app/tmp/cache/persistent /var/www/html/app/tmp/cache/models /var/www/html/app/tmp/logs \
&& chown www-data:www-data -R /var/www/html/app/tmp/cache \
&& chown www-data:www-data -R /var/www/html/app/tmp/logs
Expand Down
34 changes: 18 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
version: '3'
services:
db:
image: mariadb:10.5
container_name: ipeer_db
image: mariadb:10.11
environment:
- MYSQL_ROOT_PASSWORD=randompassword
- MYSQL_DATABASE=ipeer
- MYSQL_USER=ipeer
- MYSQL_PASSWORD=ipeer
- MARIADB_AUTO_UPGRADE=1
volumes:
- ./.data:/var/lib/mysql
- mysqlDbData:/var/lib/mysql
ports:
- "13306:3306"
adminer:
image: adminer:latest
ports:
- 8060:8080
depends_on:
- db
app: &app
image: ubcctlt/ipeer-app
build:
context: .
container_name: ipeer_app
volumes:
- .:/var/www/html
- appTmp:/var/www/html/app/tmp
environment:
- IPEER_DB_HOST=db
- IPEER_DB_USER=ipeer
Expand All @@ -43,13 +48,10 @@ services:
- db
worker: &worker
<<: *app
container_name: ipeer_worker
command: cake/console/cake worker run
ports:
- "9002:9000"
command: bash -c "sleep 5 && cake/console/cake worker run"
volumes: []
web:
image: nginx:1.19-alpine
container_name: ipeer_web
image: nginx:1.27-alpine
volumes:
- ./app/webroot:/var/www/html
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
Expand All @@ -60,15 +62,12 @@ services:

# for running unit tests
app-unittest:
image: ubcctlt/ipeer-app
image: ubcctlt/ipeer-app-unittest
build:
context: .
dockerfile: Dockerfile-app-unittest
container_name: ipeer_app_unittest
volumes:
- .:/var/www/html
ports:
- "9001:9000"
environment:
- IPEER_DB_HOST=db
- IPEER_DB_USER=ipeer
Expand All @@ -88,11 +87,14 @@ services:
# for running unit tests
web-unittest:
image: nginx:1.19-alpine
container_name: ipeer_web_unittest
volumes:
- ./app/webroot:/var/www/html
- ./docker/nginx-unittest.conf:/etc/nginx/conf.d/default.conf
ports:
- "8081:80"
depends_on:
- app-unittest

volumes:
mysqlDbData:
appTmp:
2 changes: 1 addition & 1 deletion docker/nginx-unittest.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ server {
}

location ~ ^/.+\.php(/|$) {
fastcgi_pass ipeer_app_unittest:9000;
fastcgi_pass app-unittest:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
Expand Down
2 changes: 1 addition & 1 deletion docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ server {
}

location ~ ^/.+\.php(/|$) {
fastcgi_pass ipeer_app:9000;
fastcgi_pass app:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
Expand Down
1 change: 0 additions & 1 deletion docker/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED
date.timezone = America/Vancouver
memory_limit=256M
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/opcache.so

0 comments on commit bddc00d

Please sign in to comment.