├── .gitignore.git ├── .gitignore ├── env_laravel1 ├── app │ ├── sample │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── robots.txt │ │ │ ├── index.php │ │ │ └── .htaccess │ │ ├── database │ │ │ ├── .gitignore │ │ │ ├── seeders │ │ │ │ └── DatabaseSeeder.php │ │ │ ├── migrations │ │ │ │ ├── 0001_01_01_000001_create_cache_table.php │ │ │ │ ├── 0001_01_01_000000_create_users_table.php │ │ │ │ └── 0001_01_01_000002_create_jobs_table.php │ │ │ └── factories │ │ │ │ └── UserFactory.php │ │ ├── bootstrap │ │ │ ├── cache │ │ │ │ └── .gitignore │ │ │ ├── providers.php │ │ │ └── app.php │ │ ├── resources │ │ │ ├── js │ │ │ │ ├── app.js │ │ │ │ └── bootstrap.js │ │ │ ├── css │ │ │ │ └── app.css │ │ │ └── views │ │ │ │ └── book │ │ │ │ └── index.blade.php │ │ ├── storage │ │ │ ├── logs │ │ │ │ └── .gitignore │ │ │ ├── app │ │ │ │ ├── private │ │ │ │ │ └── .gitignore │ │ │ │ ├── public │ │ │ │ │ └── .gitignore │ │ │ │ └── .gitignore │ │ │ └── framework │ │ │ │ ├── sessions │ │ │ │ └── .gitignore │ │ │ │ ├── testing │ │ │ │ └── .gitignore │ │ │ │ ├── views │ │ │ │ └── .gitignore │ │ │ │ ├── cache │ │ │ │ ├── data │ │ │ │ │ └── .gitignore │ │ │ │ └── .gitignore │ │ │ │ └── .gitignore │ │ ├── app │ │ │ ├── Http │ │ │ │ └── Controllers │ │ │ │ │ ├── Controller.php │ │ │ │ │ └── BookController.php │ │ │ ├── Models │ │ │ │ ├── Book.php │ │ │ │ └── User.php │ │ │ └── Providers │ │ │ │ └── AppServiceProvider.php │ │ ├── tests │ │ │ ├── TestCase.php │ │ │ ├── Unit │ │ │ │ └── ExampleTest.php │ │ │ └── Feature │ │ │ │ └── ExampleTest.php │ │ ├── .gitattributes │ │ ├── routes │ │ │ ├── console.php │ │ │ └── web.php │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── vite.config.js │ │ ├── package.json │ │ ├── artisan │ │ ├── config │ │ │ ├── services.php │ │ │ ├── filesystems.php │ │ │ ├── cache.php │ │ │ ├── mail.php │ │ │ └── queue.php │ │ ├── phpunit.xml │ │ ├── .env.example │ │ ├── .env │ │ ├── composer.json │ │ └── README.md │ ├── php.ini │ ├── .vscode │ │ └── launch.json │ ├── .dockerignore │ └── Dockerfile ├── db │ ├── .dockerignore │ ├── Dockerfile │ ├── init │ │ ├── 01_create_tables.sql │ │ └── 02_insert_data.sql │ └── my.cnf ├── .devcontainer │ ├── .env │ ├── devcontainer.json │ └── compose.yml └── .gitignore ├── env_laravel_nginx_fpm ├── app │ ├── sample │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── robots.txt │ │ │ ├── index.php │ │ │ └── .htaccess │ │ ├── database │ │ │ ├── .gitignore │ │ │ ├── seeders │ │ │ │ └── DatabaseSeeder.php │ │ │ ├── migrations │ │ │ │ ├── 0001_01_01_000001_create_cache_table.php │ │ │ │ ├── 0001_01_01_000000_create_users_table.php │ │ │ │ └── 0001_01_01_000002_create_jobs_table.php │ │ │ └── factories │ │ │ │ └── UserFactory.php │ │ ├── resources │ │ │ ├── js │ │ │ │ ├── app.js │ │ │ │ └── bootstrap.js │ │ │ ├── css │ │ │ │ └── app.css │ │ │ └── views │ │ │ │ └── book │ │ │ │ └── index.blade.php │ │ ├── storage │ │ │ ├── logs │ │ │ │ └── .gitignore │ │ │ ├── app │ │ │ │ ├── private │ │ │ │ │ └── .gitignore │ │ │ │ ├── public │ │ │ │ │ └── .gitignore │ │ │ │ └── .gitignore │ │ │ └── framework │ │ │ │ ├── sessions │ │ │ │ └── .gitignore │ │ │ │ ├── testing │ │ │ │ └── .gitignore │ │ │ │ ├── views │ │ │ │ └── .gitignore │ │ │ │ ├── cache │ │ │ │ ├── data │ │ │ │ │ └── .gitignore │ │ │ │ └── .gitignore │ │ │ │ └── .gitignore │ │ ├── bootstrap │ │ │ ├── cache │ │ │ │ └── .gitignore │ │ │ ├── providers.php │ │ │ └── app.php │ │ ├── app │ │ │ ├── Http │ │ │ │ └── Controllers │ │ │ │ │ ├── Controller.php │ │ │ │ │ └── BookController.php │ │ │ ├── Models │ │ │ │ ├── Book.php │ │ │ │ └── User.php │ │ │ └── Providers │ │ │ │ └── AppServiceProvider.php │ │ ├── tests │ │ │ ├── TestCase.php │ │ │ ├── Unit │ │ │ │ └── ExampleTest.php │ │ │ └── Feature │ │ │ │ └── ExampleTest.php │ │ ├── .gitattributes │ │ ├── routes │ │ │ ├── console.php │ │ │ └── web.php │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── vite.config.js │ │ ├── package.json │ │ ├── artisan │ │ ├── config │ │ │ ├── services.php │ │ │ ├── filesystems.php │ │ │ ├── cache.php │ │ │ └── mail.php │ │ ├── phpunit.xml │ │ ├── .env.example │ │ ├── .env │ │ ├── composer.json │ │ └── README.md │ ├── php.ini │ ├── .vscode │ │ └── launch.json │ ├── .dockerignore │ └── Dockerfile ├── db │ ├── .dockerignore │ ├── Dockerfile │ ├── init │ │ ├── 01_create_tables.sql │ │ └── 02_insert_data.sql │ └── my.cnf ├── .devcontainer │ ├── .env │ ├── devcontainer.json │ └── compose.yml ├── .gitignore └── nginx │ └── default.conf ├── env_https ├── .gitignore ├── app │ ├── test.md │ ├── .vscode │ │ └── launch.json │ ├── templates │ │ └── index.html │ ├── main.go │ └── go.mod ├── .devcontainer │ ├── .env │ ├── db │ │ ├── Dockerfile │ │ └── my.cnf │ ├── devcontainer.json │ ├── app │ │ └── Dockerfile │ ├── web │ │ └── default.conf │ └── compose.yml └── db │ └── init │ ├── 01_create_tables.sql │ └── 02_insert_data.sql ├── ex02 ├── php.ini ├── src │ └── phpinfo.php └── Dockerfile ├── env_node1 ├── .devcontainer │ ├── .env │ ├── devcontainer.json │ └── compose.yml ├── app │ ├── .dockerignore │ ├── Dockerfile │ ├── .vscode │ │ └── launch.json │ └── sample │ │ ├── package.json │ │ ├── book_model.js │ │ ├── views │ │ └── index.ejs │ │ └── index.js ├── .gitignore └── db │ └── init │ └── 01.js ├── env_node_nginx ├── .devcontainer │ ├── .env │ ├── devcontainer.json │ └── compose.yml ├── app │ ├── .dockerignore │ ├── Dockerfile │ ├── .vscode │ │ └── launch.json │ └── sample │ │ ├── package.json │ │ ├── book_model.js │ │ ├── views │ │ └── index.ejs │ │ └── index.js ├── .gitignore ├── web │ └── nginx.conf └── db │ └── init │ └── 01.js ├── env_go_mysql ├── .devcontainer │ ├── .env │ ├── devcontainer.json │ └── compose.yml ├── db │ ├── Dockerfile │ ├── my.cnf │ ├── init │ │ ├── 01_create_tables.sql │ │ └── 02_insert_data.sql │ └── .dockerignore ├── app │ ├── templates │ │ ├── error.html │ │ └── index.html │ ├── .dockerignore │ ├── .vscode │ │ └── launch.json │ ├── Dockerfile │ ├── go.mod │ └── main.go └── .gitignore ├── env_go_mysql_nginx ├── .devcontainer │ ├── .env │ ├── devcontainer.json │ └── compose.yml ├── db │ ├── Dockerfile │ ├── my.cnf │ ├── init │ │ ├── 01_create_tables.sql │ │ └── 02_insert_data.sql │ └── .dockerignore ├── app │ ├── templates │ │ ├── error.html │ │ └── index.html │ ├── .dockerignore │ ├── .vscode │ │ └── launch.json │ ├── Dockerfile │ ├── go.mod │ └── main.go ├── .gitignore └── web │ └── default.conf ├── env_go_mysql_nginx_cert ├── .devcontainer │ ├── .env │ ├── devcontainer.json │ └── compose.yml ├── db │ ├── Dockerfile │ ├── my.cnf │ ├── init │ │ ├── 01_create_tables.sql │ │ └── 02_insert_data.sql │ └── .dockerignore ├── app │ ├── templates │ │ ├── error.html │ │ └── index.html │ ├── .dockerignore │ ├── .vscode │ │ └── launch.json │ ├── Dockerfile │ ├── go.mod │ └── main.go ├── .gitignore └── web │ └── default.conf ├── ex01 └── Dockerfile ├── ex04 ├── public │ └── index.php ├── composer.json └── Dockerfile ├── ex11 ├── .env ├── php │ ├── composer.json │ ├── src │ │ └── sample1.php │ └── Dockerfile └── compose.yml ├── ex21 ├── php │ ├── .dockerignore │ ├── composer.json │ ├── .vscode │ │ └── launch.json │ ├── Dockerfile │ └── public │ │ └── index.php └── .devcontainer │ ├── compose.yml │ └── devcontainer.json └── ex03 ├── Dockerfile └── src └── index.html /.gitignore.git: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_https/.gitignore: -------------------------------------------------------------------------------- 1 | /db/database 2 | localhost-key.pem 3 | localhost.pem 4 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/storage/app/private/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel1/db/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .gitignore 3 | .DS_Store 4 | Thumbs.db -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/storage/app/private/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/db/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .gitignore 3 | .DS_Store 4 | Thumbs.db 5 | -------------------------------------------------------------------------------- /env_https/app/test.md: -------------------------------------------------------------------------------- 1 | # 指示: 2 | 以下の条件をもとに、レシピを作成してください 3 | 4 | # 条件: 5 | - サーモンを使う 6 | - キャンプ料理 -------------------------------------------------------------------------------- /env_laravel1/app/sample/storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !private/ 3 | !public/ 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !private/ 3 | !public/ 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /ex02/php.ini: -------------------------------------------------------------------------------- 1 | [Date] 2 | date.timezone = Asia/Tokyo 3 | 4 | [mbstring] 5 | mbstring.language = Japanese 6 | -------------------------------------------------------------------------------- /env_https/.devcontainer/.env: -------------------------------------------------------------------------------- 1 | MYSQL_ROOT_PASSWORD=root 2 | MYSQL_DATABASE=my 3 | MYSQL_USER=my 4 | MYSQL_PASSWORD=my -------------------------------------------------------------------------------- /env_laravel1/.devcontainer/.env: -------------------------------------------------------------------------------- 1 | MYSQL_ROOT_PASSWORD=root 2 | MYSQL_DATABASE=my 3 | MYSQL_USER=my 4 | MYSQL_PASSWORD=my -------------------------------------------------------------------------------- /env_laravel1/app/sample/bootstrap/providers.php: -------------------------------------------------------------------------------- 1 | ようこそ!PHP! 2 | ただいまの日時は、 です。 3 | 4 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/bootstrap/providers.php: -------------------------------------------------------------------------------- 1 | Hello from Multi-Stage Build (PHP)!
Served by container: " . htmlspecialchars($hostname) . "
"; 8 | 9 | ?> 10 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /env_go_mysql/db/init/01_create_tables.sql: -------------------------------------------------------------------------------- 1 | -- books テーブルを作成 2 | CREATE TABLE IF NOT EXISTS books ( 3 | id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, 4 | title VARCHAR(255) NOT NULL, -- 長さを指定し、NOT NULL制約を追加 5 | insert_timestamp DATETIME DEFAULT CURRENT_TIMESTAMP -- デフォルト値を設定 6 | ); 7 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 8 | })->purpose('Display an inspiring quote'); 9 | -------------------------------------------------------------------------------- /ex11/.env: -------------------------------------------------------------------------------- 1 | # PostgreSQL Settings 2 | POSTGRES_USER=postgres 3 | POSTGRES_PASSWORD=postgres 4 | POSTGRES_DB=postgres 5 | 6 | # Database connection settings for PHP application 7 | DB_HOST=db 8 | DB_PORT=5432 9 | DB_DATABASE=postgres 10 | DB_USER=postgres 11 | DB_PASSWORD=postgres -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 8 | })->purpose('Display an inspiring quote'); 9 | -------------------------------------------------------------------------------- /ex11/php/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ex11/app", 3 | "description": "PHP application connecting to PostgreSQL", 4 | "type": "project", 5 | "autoload": { 6 | "psr-4": { 7 | "App\\": "src/" 8 | } 9 | }, 10 | "require": {} 11 | } 12 | -------------------------------------------------------------------------------- /env_go_mysql_nginx/db/init/01_create_tables.sql: -------------------------------------------------------------------------------- 1 | -- books テーブルを作成 2 | CREATE TABLE IF NOT EXISTS books ( 3 | id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, 4 | title VARCHAR(255) NOT NULL, -- 長さを指定し、NOT NULL制約を追加 5 | insert_timestamp DATETIME DEFAULT CURRENT_TIMESTAMP -- デフォルト値を設定 6 | ); 7 | -------------------------------------------------------------------------------- /env_go_mysql_nginx_cert/db/init/01_create_tables.sql: -------------------------------------------------------------------------------- 1 | -- books テーブルを作成 2 | CREATE TABLE IF NOT EXISTS books ( 3 | id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, 4 | title VARCHAR(255) NOT NULL, -- 長さを指定し、NOT NULL制約を追加 5 | insert_timestamp DATETIME DEFAULT CURRENT_TIMESTAMP -- デフォルト値を設定 6 | ); 7 | -------------------------------------------------------------------------------- /ex04/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ex04/simple-app", 3 | "description": "A simple PHP web application example for multi-stage build.", 4 | "type": "project", 5 | "autoload": { 6 | "psr-4": { 7 | "App\\": "src/" 8 | } 9 | }, 10 | "require": {} 11 | } -------------------------------------------------------------------------------- /env_https/app/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Launch Package", 6 | "type": "go", 7 | "request": "launch", 8 | "mode": "auto", 9 | "program": "${fileDirname}" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /env_go_mysql/db/.dockerignore: -------------------------------------------------------------------------------- 1 | # Git files 2 | .git 3 | .gitignore 4 | 5 | # Initialization scripts (mounted via volume) 6 | init/ 7 | 8 | # Docker files 9 | Dockerfile 10 | .dockerignore 11 | 12 | # OS generated files 13 | .DS_Store 14 | Thumbs.db 15 | 16 | # MySQL config (copied in Dockerfile, so keep it) 17 | # !my.cnf 18 | -------------------------------------------------------------------------------- /env_go_mysql_nginx/db/.dockerignore: -------------------------------------------------------------------------------- 1 | # Git files 2 | .git 3 | .gitignore 4 | 5 | # Initialization scripts (mounted via volume) 6 | init/ 7 | 8 | # Docker files 9 | Dockerfile 10 | .dockerignore 11 | 12 | # OS generated files 13 | .DS_Store 14 | Thumbs.db 15 | 16 | # MySQL config (copied in Dockerfile, so keep it) 17 | # !my.cnf -------------------------------------------------------------------------------- /env_go_mysql_nginx/db/init/02_insert_data.sql: -------------------------------------------------------------------------------- 1 | -- 初期データの挿入 (存在しない場合のみ) 2 | INSERT INTO books (title) VALUES 3 | ('プログラミング言語C'), 4 | ('やさしいコンピューター科学'), 5 | ('ゲーデル、エッシャー、バッハ―あるいは不思議の環'), 6 | ('TeXブック コンピュータによる組版システム'), 7 | ('人月の神話 狼人間を撃つ銀の弾はない') 8 | ON DUPLICATE KEY UPDATE title=title; -- 重複を無視する (例: idが重複した場合など) 9 | -- もしくは、テーブルが空の場合のみ挿入するなどの工夫が必要 -------------------------------------------------------------------------------- /env_go_mysql_nginx_cert/db/.dockerignore: -------------------------------------------------------------------------------- 1 | # Git files 2 | .git 3 | .gitignore 4 | 5 | # Initialization scripts (mounted via volume) 6 | init/ 7 | 8 | # Docker files 9 | Dockerfile 10 | .dockerignore 11 | 12 | # OS generated files 13 | .DS_Store 14 | Thumbs.db 15 | 16 | # MySQL config (copied in Dockerfile, so keep it) 17 | # !my.cnf -------------------------------------------------------------------------------- /env_go_mysql_nginx_cert/db/init/02_insert_data.sql: -------------------------------------------------------------------------------- 1 | -- 初期データの挿入 (存在しない場合のみ) 2 | INSERT INTO books (title) VALUES 3 | ('プログラミング言語C'), 4 | ('やさしいコンピューター科学'), 5 | ('ゲーデル、エッシャー、バッハ―あるいは不思議の環'), 6 | ('TeXブック コンピュータによる組版システム'), 7 | ('人月の神話 狼人間を撃つ銀の弾はない') 8 | ON DUPLICATE KEY UPDATE title=title; -- 重複を無視する (例: idが重複した場合など) 9 | -- もしくは、テーブルが空の場合のみ挿入するなどの工夫が必要 -------------------------------------------------------------------------------- /env_node1/app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:22-alpine 2 | 3 | # タイムゾーン設定 4 | RUN apk --update --no-cache add \ 5 | tzdata \ 6 | && cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \ 7 | && apk del tzdata 8 | 9 | # 作業ディレクトリ設定 10 | WORKDIR /var/www/html 11 | 12 | # 非rootユーザーで実行 13 | USER node 14 | 15 | # アプリケーションが使用するポートを公開 16 | EXPOSE 3000 -------------------------------------------------------------------------------- /env_go_mysql/db/init/02_insert_data.sql: -------------------------------------------------------------------------------- 1 | -- 初期データの挿入 (存在しない場合のみ) 2 | INSERT INTO books (title) VALUES 3 | ('プログラミング言語C'), 4 | ('やさしいコンピューター科学'), 5 | ('ゲーデル、エッシャー、バッハ―あるいは不思議の環'), 6 | ('TeXブック コンピュータによる組版システム'), 7 | ('人月の神話 狼人間を撃つ銀の弾はない') 8 | ON DUPLICATE KEY UPDATE title=title; -- 重複を無視する (例: idが重複した場合など) 9 | -- もしくは、テーブルが空の場合のみ挿入するなどの工夫が必要 10 | -------------------------------------------------------------------------------- /env_node1/app/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "node", 6 | "request": "launch", 7 | "name": "Launch Sample", 8 | "program": "${workspaceFolder}/sample/index.js", 9 | "cwd": "${workspaceFolder}/sample" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /env_node_nginx/app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:22-alpine 2 | 3 | # タイムゾーン設定 4 | RUN apk --update --no-cache add \ 5 | tzdata \ 6 | && cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \ 7 | && apk del tzdata 8 | 9 | # 作業ディレクトリ設定 10 | WORKDIR /var/www/html 11 | 12 | # 非rootユーザーで実行 13 | USER node 14 | 15 | # アプリケーションが使用するポートを公開 (コンテナ内部) 16 | EXPOSE 3000 -------------------------------------------------------------------------------- /env_node1/.gitignore: -------------------------------------------------------------------------------- 1 | # プロジェクトルートの .gitignore 2 | # OS固有ファイル 3 | .DS_Store 4 | Thumbs.db 5 | 6 | # IDE/Editor設定 7 | # .vscode/ 8 | # !.vscode/launch.json 9 | 10 | # 依存関係 11 | /app/node_modules/ 12 | 13 | # ログファイル 14 | *.log 15 | npm-debug.log* 16 | 17 | # 環境変数ファイル 18 | # .env 19 | # /.devcontainer/.env 20 | 21 | # MongoDB データディレクトリ 22 | /db/database/ -------------------------------------------------------------------------------- /env_go_mysql/app/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |{{ .message }}
11 | 12 | 13 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/tests/Unit/ExampleTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /env_go_mysql_nginx/app/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |{{ .message }}
11 | 12 | 13 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/tests/Unit/ExampleTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /env_go_mysql_nginx_cert/app/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |{{ .message }}
11 | 12 | 13 | -------------------------------------------------------------------------------- /env_laravel1/app/php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | log_errors = On 3 | error_log = /dev/stderr 4 | date.timezone = Asia/Tokyo 5 | 6 | [mbstring] 7 | mbstring.language = Japanese 8 | 9 | [xdebug] 10 | xdebug.mode = debug 11 | xdebug.start_with_request = trigger 12 | xdebug.client_port = 9003 13 | xdebug.client_host = host.docker.internal 14 | xdebug.idekey = VSCODE 15 | xdebug.log_level = 0 -------------------------------------------------------------------------------- /env_laravel1/app/sample/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /env_https/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Https Nginx", 3 | "dockerComposeFile": "compose.yml", 4 | "service": "app", 5 | "workspaceFolder": "/var/www/html", 6 | "customizations": { 7 | "vscode": { 8 | "extensions": [ 9 | "golang.Go" 10 | ], 11 | "settings": { 12 | "editor.tabSize": 2 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | log_errors = On 3 | error_log = /dev/stderr 4 | date.timezone = Asia/Tokyo 5 | 6 | [mbstring] 7 | mbstring.language = Japanese 8 | 9 | [xdebug] 10 | xdebug.mode = debug 11 | xdebug.start_with_request = trigger 12 | xdebug.client_port = 9003 13 | xdebug.client_host = host.docker.internal 14 | xdebug.idekey = VSCODE 15 | xdebug.log_level = 0 -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /env_https/db/init/02_insert_data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO books VALUES(1, 'プログラミング言語C', current_timestamp); 2 | INSERT INTO books VALUES(2, 'やさしいコンピューター科学', current_timestamp); 3 | INSERT INTO books VALUES(3, 'ゲーデル、エッシャー、バッハ―あるいは不思議の環', current_timestamp); 4 | INSERT INTO books VALUES(4, 'TeXブック コンピュータによる組版システム', current_timestamp); 5 | INSERT INTO books VALUES(5, '人月の神話 狼人間を撃つ銀の弾はない', current_timestamp); 6 | -------------------------------------------------------------------------------- /env_node_nginx/app/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "node", 6 | "request": "launch", 7 | "name": "Launch Sample", 8 | "program": "${workspaceFolder}/sample/index.js", // 起動するスクリプト 9 | "cwd": "${workspaceFolder}/sample", // 実行時のカレントディレクトリ 10 | // デバッグポートはVS Codeが自動的にフォワードするため、通常は設定不要 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /env_go_mysql/app/.dockerignore: -------------------------------------------------------------------------------- 1 | # Git files 2 | .git 3 | .gitignore 4 | 5 | # IDE/Editor specific 6 | # .vscode/ 7 | 8 | # Docker files 9 | Dockerfile 10 | .dockerignore 11 | 12 | # OS generated files 13 | .DS_Store 14 | Thumbs.db 15 | 16 | # Log files 17 | *.log 18 | 19 | # Go build artifacts (local builds) 20 | *.exe 21 | *.out 22 | app 23 | 24 | # Environment files (if present in this directory) 25 | # .env -------------------------------------------------------------------------------- /env_laravel1/app/sample/.gitignore: -------------------------------------------------------------------------------- 1 | /.phpunit.cache 2 | /node_modules 3 | /public/build 4 | /public/hot 5 | /public/storage 6 | /storage/*.key 7 | /storage/pail 8 | /vendor 9 | .env.backup 10 | .env.production 11 | .phpactor.json 12 | .phpunit.result.cache 13 | Homestead.json 14 | Homestead.yaml 15 | npm-debug.log 16 | yarn-error.log 17 | /auth.json 18 | /.fleet 19 | /.idea 20 | /.nova 21 | /.vscode 22 | /.zed 23 | -------------------------------------------------------------------------------- /ex02/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-apache 2 | 3 | # tzdataのインストール 4 | RUN apt-get update -qq \ 5 | && apt-get install -y --no-install-recommends tzdata \ 6 | && rm -rf /var/lib/apt/lists/* 7 | 8 | # タイムゾーンを設定する環境変数 9 | ENV TZ="Asia/Tokyo" 10 | 11 | # 作業ディレクトリを変更 12 | WORKDIR /usr/local/etc/php 13 | 14 | # ファイルのコピー 15 | COPY php.ini . 16 | 17 | # 一時変数の定義 18 | ARG wdir 19 | 20 | # 作業ディレクトリを変更 21 | WORKDIR $wdir 22 | -------------------------------------------------------------------------------- /env_go_mysql_nginx/app/.dockerignore: -------------------------------------------------------------------------------- 1 | # Git files 2 | .git 3 | .gitignore 4 | 5 | # IDE/Editor specific 6 | # .vscode/ 7 | 8 | # Docker files 9 | Dockerfile 10 | .dockerignore 11 | 12 | # OS generated files 13 | .DS_Store 14 | Thumbs.db 15 | 16 | # Log files 17 | *.log 18 | 19 | # Go build artifacts (local builds) 20 | *.exe 21 | *.out 22 | app 23 | 24 | # Environment files (if present in this directory) 25 | # .env -------------------------------------------------------------------------------- /env_go_mysql_nginx_cert/app/.dockerignore: -------------------------------------------------------------------------------- 1 | # Git files 2 | .git 3 | .gitignore 4 | 5 | # IDE/Editor specific 6 | # .vscode/ 7 | 8 | # Docker files 9 | Dockerfile 10 | .dockerignore 11 | 12 | # OS generated files 13 | .DS_Store 14 | Thumbs.db 15 | 16 | # Log files 17 | *.log 18 | 19 | # Go build artifacts (local builds) 20 | *.exe 21 | *.out 22 | app 23 | 24 | # Environment files (if present in this directory) 25 | # .env -------------------------------------------------------------------------------- /env_laravel1/app/sample/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | import tailwindcss from '@tailwindcss/vite'; 4 | 5 | export default defineConfig({ 6 | plugins: [ 7 | laravel({ 8 | input: ['resources/css/app.css', 'resources/js/app.js'], 9 | refresh: true, 10 | }), 11 | tailwindcss(), 12 | ], 13 | }); 14 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/.gitignore: -------------------------------------------------------------------------------- 1 | /.phpunit.cache 2 | /node_modules 3 | /public/build 4 | /public/hot 5 | /public/storage 6 | /storage/*.key 7 | /storage/pail 8 | /vendor 9 | .env.backup 10 | .env.production 11 | .phpactor.json 12 | .phpunit.result.cache 13 | Homestead.json 14 | Homestead.yaml 15 | npm-debug.log 16 | yarn-error.log 17 | /auth.json 18 | /.fleet 19 | /.idea 20 | /.nova 21 | /.vscode 22 | /.zed 23 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | import tailwindcss from '@tailwindcss/vite'; 4 | 5 | export default defineConfig({ 6 | plugins: [ 7 | laravel({ 8 | input: ['resources/css/app.css', 'resources/js/app.js'], 9 | refresh: true, 10 | }), 11 | tailwindcss(), 12 | ], 13 | }); 14 | -------------------------------------------------------------------------------- /env_https/.devcontainer/app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.20-alpine 2 | 3 | # パッケージのインストール、タイムゾーン設定 4 | RUN apk --update --no-cache add \ 5 | tzdata \ 6 | && cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \ 7 | && apk del tzdata 8 | 9 | # デバッグ用ツールのインストール 10 | RUN go install -v github.com/ramya-rao-a/go-outline@latest \ 11 | && go install -v golang.org/x/tools/gopls@latest \ 12 | && go install -v github.com/go-delve/delve/cmd/dlv@latest 13 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module", 4 | "scripts": { 5 | "build": "vite build", 6 | "dev": "vite" 7 | }, 8 | "devDependencies": { 9 | "@tailwindcss/vite": "^4.0.0", 10 | "axios": "^1.8.2", 11 | "concurrently": "^9.0.1", 12 | "laravel-vite-plugin": "^1.2.0", 13 | "tailwindcss": "^4.0.0", 14 | "vite": "^6.2.4" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /env_node_nginx/.gitignore: -------------------------------------------------------------------------------- 1 | # プロジェクトルートの .gitignore 2 | # OS固有ファイル 3 | .DS_Store 4 | Thumbs.db 5 | 6 | # IDE/Editor設定 7 | # .vscode/ 8 | # !.vscode/launch.json 9 | 10 | # 依存関係 11 | /app/node_modules/ 12 | 13 | # ログファイル 14 | *.log 15 | npm-debug.log* 16 | 17 | # 環境変数ファイル 18 | # .env 19 | # /.devcontainer/.env 20 | 21 | # MongoDB データボリューム (Docker管理なのでGitでは無視) 22 | # db-data/ (ボリューム名を直接指定するわけではない) 23 | 24 | # Nginx設定(環境依存の可能性がある場合) 25 | # /web/nginx.conf 26 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module", 4 | "scripts": { 5 | "build": "vite build", 6 | "dev": "vite" 7 | }, 8 | "devDependencies": { 9 | "@tailwindcss/vite": "^4.0.0", 10 | "axios": "^1.8.2", 11 | "concurrently": "^9.0.1", 12 | "laravel-vite-plugin": "^1.2.0", 13 | "tailwindcss": "^4.0.0", 14 | "vite": "^6.2.4" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /env_https/app/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 || {{.Id}} | 13 |{{.Title}} | 14 |{{.InsertTimestamp}} | 15 |
| # | 17 |タイトル | 18 |登録日時 | 19 |
|---|---|---|
| <%= index + 1 %> | 25 |<%= book.title %> | 26 |<%= book.date %> | <%# index.js でフォーマット済みの date を表示 %> 27 |
| # | 17 |タイトル | 18 |登録日時 | 19 |
|---|---|---|
| <%= index + 1 %> | 25 |<%= book.title %> | 26 |<%= book.date %> | <%# index.js でフォーマット済みの date を表示 %> 27 |
| ID | 18 |Title | 19 |Timestamp | 20 |
|---|---|---|
| {{ $book->id }} | 26 |{{ $book->title }} | 27 |{{ $book->insert_timestamp }} | 28 |
| No books found. | 32 |||
| ID | 18 |Title | 19 |Timestamp | 20 |
|---|---|---|
| {{ $book->id }} | 26 |{{ $book->title }} | 27 |{{ $book->insert_timestamp }} | 28 |
| No books found. | 32 |||
| ID | 22 |タイトル | 23 |登録日時 | 24 |
|---|---|---|
| {{ .Id }} | 30 |{{ .Title }} | 31 |{{ if .InsertTimestamp }}{{ .InsertTimestamp.Format "2006-01-02 15:04:05" }}{{ else }}N/A{{ end }} | 32 |
登録されている書籍はありません。
38 | {{ end }} 39 | 40 | -------------------------------------------------------------------------------- /env_go_mysql_nginx/app/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 || ID | 22 |タイトル | 23 |登録日時 | 24 |
|---|---|---|
| {{ .Id }} | 30 |{{ .Title }} | 31 |{{ if .InsertTimestamp }}{{ .InsertTimestamp.Format "2006-01-02 15:04:05" }}{{ else }}N/A{{ end }} | 32 |
登録されている書籍はありません。
38 | {{ end }} 39 | 40 | -------------------------------------------------------------------------------- /env_go_mysql_nginx_cert/app/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 || ID | 22 |タイトル | 23 |登録日時 | 24 |
|---|---|---|
| {{ .Id }} | 30 |{{ .Title }} | 31 |{{ if .InsertTimestamp }}{{ .InsertTimestamp.Format "2006-01-02 15:04:05" }}{{ else }}N/A{{ end }} | 32 |
登録されている書籍はありません。
38 | {{ end }} 39 | 40 | -------------------------------------------------------------------------------- /env_https/app/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "time" 5 | "log" 6 | "gorm.io/gorm" 7 | "gorm.io/driver/mysql" 8 | "net/http" 9 | "github.com/gin-gonic/gin" 10 | ) 11 | 12 | // 構造体の定義 13 | type Books struct { 14 | Id int `gorm:"column:id"` 15 | Title string `gorm:"column:title"` 16 | InsertTimestamp *time.Time `gorm:"column:insert_timestamp"` 17 | } 18 | 19 | func main() { 20 | // DBへ接続 21 | dsn := "my:my@tcp(https1-db:3306)/my?charset=utf8mb4&parseTime=True&loc=Local" 22 | db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{}) 23 | if err != nil { 24 | panic(err) 25 | } 26 | // 使い終わったらDB接続を閉じる 27 | mydb, err := db.DB() 28 | defer mydb.Close() 29 | 30 | // データを格納する変数を定義 31 | books := []Books{} 32 | 33 | // booksテーブルのレコードを全て取得 34 | db.Find(&books) 35 | 36 | // Ginの準備 37 | router := gin.Default() 38 | // テンプレートフォルダを指定 39 | router.LoadHTMLGlob("templates/*") 40 | 41 | // リクエストに対する応答を定義 42 | router.GET("/", func(c *gin.Context){ 43 | c.HTML(http.StatusOK, "index.html", gin.H{"books": books}) 44 | // ログに出力 45 | log.Println("アクセスがありました。booksのレコード数:", len(books)) 46 | }) 47 | 48 | // 接続待ち 49 | router.Run(":3000") 50 | } -------------------------------------------------------------------------------- /env_node1/.devcontainer/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | build: 4 | context: ../app 5 | ports: 6 | - '3000:3000' 7 | stdin_open: true 8 | tty: true 9 | volumes: 10 | - ../app:/var/www/html 11 | depends_on: 12 | db: 13 | condition: service_healthy 14 | environment: 15 | - WATCHPACK_POLLING=true 16 | 17 | db: 18 | image: mongo:8.0 19 | expose: 20 | - "27017" 21 | environment: 22 | - TZ=Asia/Tokyo 23 | - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME} 24 | - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD} 25 | - MONGO_INITDB_DATABASE=${MONGO_INITDB_DATABASE} 26 | volumes: 27 | - db-data:/data/db 28 | - ../db/init:/docker-entrypoint-initdb.d 29 | healthcheck: 30 | test: | 31 | mongosh --host localhost --port 27017 \ 32 | --username $$MONGO_INITDB_ROOT_USERNAME \ 33 | --password $$MONGO_INITDB_ROOT_PASSWORD \ 34 | --authenticationDatabase admin --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 1)' 35 | interval: 10s 36 | timeout: 5s 37 | retries: 5 38 | start_period: 30s 39 | 40 | volumes: 41 | db-data: -------------------------------------------------------------------------------- /env_https/.devcontainer/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | image: https1/app:1.0 4 | build: ./app 5 | container_name: 'https1-app' 6 | expose: 7 | - "3000" 8 | stdin_open: true 9 | tty: true 10 | working_dir: '/var/www/html' 11 | volumes: 12 | - ../app:/var/www/html 13 | depends_on: 14 | - db 15 | 16 | db: 17 | image: https1/mysql:1.0 18 | build: ./db 19 | container_name: 'https1-db' 20 | expose: 21 | - "3306" 22 | environment: 23 | - TZ=Asia/Tokyo 24 | - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} 25 | - MYSQL_DATABASE=${MYSQL_DATABASE} 26 | - MYSQL_USER=${MYSQL_USER} 27 | - MYSQL_PASSWORD=${MYSQL_PASSWORD} 28 | volumes: 29 | - ../db/database:/var/lib/mysql 30 | - ../db/init:/docker-entrypoint-initdb.d 31 | 32 | web: 33 | image: nginx:1.19 34 | container_name: 'https1-web' 35 | ports: 36 | - '443:443' 37 | depends_on: 38 | - app 39 | volumes: 40 | - ./web/default.conf:/etc/nginx/conf.d/default.conf 41 | - ./web/localhost.pem:/etc/certs/localhost.pem 42 | - ./web/localhost-key.pem:/etc/certs/localhost-key.pem 43 | - ../app:/var/www/html -------------------------------------------------------------------------------- /ex11/php/src/sample1.php: -------------------------------------------------------------------------------- 1 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 24 | 25 | echo "データベースに接続しました。\n"; 26 | 27 | // pg_userテーブルの内容を取得するクエリを実行 28 | $stmt = $pdo->query('SELECT usename, usesysid FROM pg_catalog.pg_user'); 29 | 30 | // 結果を取得して表示 31 | echo "pg_user テーブルの内容:\n"; 32 | while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { 33 | print_r($row); 34 | } 35 | 36 | } catch (PDOException $e) { 37 | // 接続またはクエリ実行中にエラーが発生した場合 38 | echo "データベースエラー: " . $e->getMessage() . "\n"; 39 | exit(1); 40 | } 41 | 42 | ?> -------------------------------------------------------------------------------- /ex21/php/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Listen for Xdebug", // Webリクエストのデバッグ用設定 6 | "type": "php", // デバッガーの種類 (xdebug.php-debug 拡張機能用) 7 | "request": "launch", 8 | "port": 9003, // Xdebug が接続待機するポート (php.ini/xdebug.ini の xdebug.client_port と一致) 9 | "pathMappings": { 10 | "/app": "${workspaceFolder}" // コンテナ内のパス (/app) をホストのワークスペースパスにマッピング 11 | }, 12 | "hostname": "0.0.0.0", // VS Code デバッガーが接続を待機するアドレス 13 | "log": false // デバッグアダプタのログ (問題発生時にtrueに) 14 | }, 15 | { 16 | "name": "PHP: Current File", // CLI スクリプトのデバッグ用設定 17 | "type": "php", 18 | "request": "launch", 19 | "program": "${file}", // 現在アクティブなファイルを実行 20 | "cwd": "${workspaceFolder}", 21 | "runtimeExecutable": "/usr/local/bin/php", 22 | "externalConsole": false, 23 | "internalConsoleOptions": "openOnSessionStart" 24 | // CLIデバッグでもXdebugを使う場合、環境変数 XDEBUG_MODE=debug XDEBUG_CONFIG="client_host=localhost client_port=9003" などを設定する必要がある場合がある 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /env_laravel1/app/sample/config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'token' => env('POSTMARK_TOKEN'), 19 | ], 20 | 21 | 'ses' => [ 22 | 'key' => env('AWS_ACCESS_KEY_ID'), 23 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 24 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 25 | ], 26 | 27 | 'resend' => [ 28 | 'key' => env('RESEND_KEY'), 29 | ], 30 | 31 | 'slack' => [ 32 | 'notifications' => [ 33 | 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), 34 | 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), 35 | ], 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/Dockerfile: -------------------------------------------------------------------------------- 1 | # 軽量PHP-FPMイメージ 2 | FROM php:8.3-fpm-alpine as runtime 3 | 4 | # Composer 実行ファイルをコピー 5 | COPY --from=composer:latest /usr/bin/composer /usr/bin/composer 6 | 7 | RUN addgroup -S -g 1000 appgroup && \ 8 | adduser -S -u 1000 -G appgroup -s /bin/sh appuser 9 | 10 | RUN apk update && \ 11 | apk add --no-cache \ 12 | tzdata \ 13 | icu-libs \ 14 | libzip \ 15 | oniguruma \ 16 | git \ 17 | && \ 18 | apk add --no-cache --virtual .build-deps \ 19 | $PHPIZE_DEPS \ 20 | linux-headers \ 21 | icu-dev \ 22 | libzip-dev \ 23 | oniguruma-dev \ 24 | && \ 25 | pecl install xdebug && \ 26 | docker-php-ext-configure zip && \ 27 | docker-php-ext-install -j$(nproc) \ 28 | pdo_mysql \ 29 | intl \ 30 | zip \ 31 | mbstring \ 32 | && \ 33 | docker-php-ext-enable xdebug && \ 34 | apk del .build-deps && \ 35 | rm -rf /var/cache/apk/* 36 | 37 | # PHP設定ファイルをコピー (Dockerfileと同じディレクトリから) 38 | COPY php.ini /usr/local/etc/php/conf.d/custom-php.ini 39 | 40 | WORKDIR /var/www/html 41 | 42 | ENV TZ="Asia/Tokyo" 43 | USER appuser 44 | 45 | # PHP-FPM をフォアグラウンドで起動 (ベースイメージに含まれている場合が多いが明示) 46 | CMD ["php-fpm"] -------------------------------------------------------------------------------- /env_laravel_nginx_fpm/app/sample/config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'token' => env('POSTMARK_TOKEN'), 19 | ], 20 | 21 | 'ses' => [ 22 | 'key' => env('AWS_ACCESS_KEY_ID'), 23 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 24 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 25 | ], 26 | 27 | 'resend' => [ 28 | 'key' => env('RESEND_KEY'), 29 | ], 30 | 31 | 'slack' => [ 32 | 'notifications' => [ 33 | 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), 34 | 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), 35 | ], 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /env_laravel1/app/sample/app/Models/User.php: -------------------------------------------------------------------------------- 1 | */ 13 | use HasFactory, Notifiable; 14 | 15 | /** 16 | * The attributes that are mass assignable. 17 | * 18 | * @var listこれはPHPビルトインWebサーバーによって提供されるシンプルなWebページです。
72 | 73 |