feat: 초기 도커(PHP 8.3, Nginx, MySQL) 환경 세팅

This commit is contained in:
2026-02-23 10:36:12 +09:00
commit e2477845c7
9 changed files with 201 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
-- 팀원들이 공통으로 사용할 초기 테이블 구조 생성
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL,
email VARCHAR(100) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- 초기 테스트를 위한 더미 데이터 삽입 (선택 사항)
INSERT INTO users (username, email) VALUES
('test_user_1', 'user1@hmac-edu.com'),
('test_user_2', 'user2@hmac-edu.com');

17
docker/nginx/default.conf Normal file
View File

@@ -0,0 +1,17 @@
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass app:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

View File

@@ -0,0 +1,17 @@
server {
listen 8082;
server_name localhost;
root /var/www/html/hmac_edu;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass app:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

19
docker/php/dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM php:8.3-fpm
RUN apt-get update && apt-get install -y \
git \
unzip \
libzip-dev \
libpng-dev \
libonig-dev \
libxml2-dev \
&& docker-php-ext-install pdo_mysql mbstring zip \
&& rm -rf /var/lib/apt/lists/*
# Composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# 3. MySQL 연결을 위한 PHP 확장 모듈 및 기타 필수 모듈 설치
RUN docker-php-ext-install pdo pdo_mysql mysqli zip
WORKDIR /var/www/html