Skip to content

Commit

Permalink
Refactor: Properly namespace ASP services in docker-compose.yml for…
Browse files Browse the repository at this point in the history
… better reusability
  • Loading branch information
leojonathanoh committed Sep 30, 2022
1 parent 46616e3 commit 9129003
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.nginx.prod
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ FROM nginx:1.21-alpine AS final

# Add default configs
COPY --from=build /src /src
COPY config/nginx/nginx.conf /etc/nginx/nginx.conf
COPY config/ASP/nginx/nginx.conf /etc/nginx/nginx.conf
5 changes: 2 additions & 3 deletions Dockerfile.php.prod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ RUN php -i
RUN php -m

# Add default configs

COPY --from=build /src /src
COPY ./config/php/conf.d/php.ini /usr/local/etc/php/conf.d/php.ini
COPY ./config/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf
COPY ./config/ASP/php/conf.d/php.ini /usr/local/etc/php/conf.d/php.ini
COPY ./config/ASP/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf
2 changes: 1 addition & 1 deletion config/nginx/nginx.conf → config/ASP/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ http {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_MOD_REWRITE On; # Tell PHP that the mod_rewrite module is ENABLED.
fastcgi_index index.php;
fastcgi_pass php:9000;
fastcgi_pass asp-php:9000;
}

location / {
Expand Down
File renamed without changes.
File renamed without changes.
20 changes: 12 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ services:
find /src -type f -exec chmod 644 {} \;
echo "Granting php write permissions"
chmod 777 /src/ASP/system/config
chmod 666 /src/ASP/system/config/config.php
chmod 666 /src/ASP/system/config/config.php.bak || true
find /src/ASP/system/backups -type d -exec chmod 777 {} \;
find /src/ASP/system/backups -type f -exec chmod 666 {} \;
Expand All @@ -44,20 +48,20 @@ services:
echo "Granting db write permissions"
chown -R 999:999 /var/lib/mysql
nginx:
asp-nginx:
image: nginx:1.21-alpine
volumes:
- ./src:/src
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./config/ASP/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- 8081:80
networks:
- bf2-network
depends_on:
- init-container
- php
- asp-php

php:
asp-php:
build:
dockerfile: Dockerfile.php.dev
volumes:
Expand All @@ -66,8 +70,8 @@ services:
# - ./config/ASP/armyAbbreviationMap.php:/src/ASP/system/config/armyAbbreviationMap.php:ro # Optional: Customize as needed if using a custom mod
# - ./config/ASP/backendAwards.php:/src/ASP/system/config/backendAwards.php:ro # Optional: Customize as needed if using a custom mod
# - ./config/ASP/ranks.php:/src/ASP/system/config/ranks.php:ro # Optional: Customize as needed if using a custom mod
- ./config/php/conf.d/php.ini:/usr/local/etc/php/conf.d/php.ini:ro
- ./config/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
- ./config/ASP/php/conf.d/php.ini:/usr/local/etc/php/conf.d/php.ini:ro
- ./config/ASP/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
- backups-volume:/src/ASP/system/backups # This volume is effectively unused since ASP doesn't allow DB backups for a remote DB, but mount it anyway to avoid errors.
- cache-volume:/src/ASP/system/cache
- logs-volume:/src/ASP/system/logs
Expand All @@ -85,8 +89,8 @@ services:
image: mariadb:10.8
environment:
- MARIADB_ROOT_PASSWORD=ascent
# - MARIADB_USER=myuser # Uncomment this if you want to create a regular user
# - MARIADB_PASSWORD=mypassword # Uncomment this if you want to create a regular user
# - MARIADB_USER=admin # Uncomment this if you want to create a regular user
# - MARIADB_PASSWORD=admin # Uncomment this if you want to create a regular user
- MARIADB_DATABASE=bf2stats
volumes:
- db-volume:/var/lib/mysql
Expand Down

0 comments on commit 9129003

Please sign in to comment.