Skip to content

Commit 262b1ce

Browse files
committed
UPDATE: docker-compose.prod(documentation)
1 parent 89ab019 commit 262b1ce

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

docker-compose.prod.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,61 @@
1+
# Production Docker Configuration for CodeIgniter 4 Application
2+
# =============================================================
3+
#
4+
# This Docker Compose configuration is designed for production deployment of a
5+
# CodeIgniter 4 application. It defines four main services: the application itself (`app`),
6+
# an Nginx web server (`nginx`), a MySQL database (`mysql`), and a Redis cache (`redis`).
7+
# Each service is configured with production in mind, using Alpine images where available
8+
# for their smaller footprint and setting environment variables for secure and efficient operation.
9+
#
10+
# Usage:
11+
# ------
12+
# Before running, ensure you have set the environment variables `MYSQL_PROD_DATABASE`,
13+
# `MYSQL_PROD_USER`, and `MYSQL_PROD_PASSWORD` for the MySQL service. These can be set
14+
# in an `.env` file located in the same directory as this docker-compose file or exported
15+
# directly in your shell.
16+
#
17+
# To start all services in detached mode, use:
18+
# `docker-compose -f docker-compose.prod.yml up -d`
19+
#
20+
# To stop all services and remove containers, networks, and volumes created by `up`, use:
21+
# `docker-compose -f docker-compose.prod.yml down`
22+
#
23+
# Services:
24+
# ---------
25+
# app: The main application service built from a Dockerfile located in `./docker/ci4`.
26+
# It's configured to run in a `production` environment. The entire application directory
27+
# is mounted into the container to facilitate easy updates, but consider using COPY
28+
# in Dockerfile for a more secure, immutable deployment.
29+
#
30+
# nginx: Serves as the web server, using the lightweight Alpine Linux version of Nginx.
31+
# It serves static files directly and proxies PHP requests to the `app` service.
32+
# The production Nginx configuration is mounted from `./docker/nginx/nginx.prod.conf`.
33+
#
34+
# mysql: The MySQL database service, crucial for data persistence. It's configured through
35+
# environment variables for the database name, user, and password, which should be
36+
# securely managed. Data is persisted in a Docker volume named `mysql-data`.
37+
#
38+
# redis: Used for caching and session storage to enhance application performance.
39+
# Like Nginx, it uses an Alpine Linux image for a smaller footprint.
40+
#
41+
# Networks:
42+
# ---------
43+
# app-network: A custom bridge network that facilitates communication between services.
44+
# All services are attached to this network.
45+
#
46+
# Volumes:
47+
# --------
48+
# mysql-data: A Docker-managed volume that ensures the persistence of MySQL data across
49+
# container restarts and deployments.
50+
#
51+
# Notes:
52+
# ------
53+
# - This configuration is optimized for production use, but security and performance
54+
# tuning is an ongoing process. Always keep your images up to date and monitor
55+
# for any potential security vulnerabilities.
56+
# - Ensure SSL/TLS configuration for Nginx if exposing services directly to the internet.
57+
# Consider using a service like Let's Encrypt for free SSL certificates.
58+
#
159
version: '3.8'
260
services:
361
app:

0 commit comments

Comments
 (0)